ImageView and covering its round transparent gradient



  • Dano:

    ImageView, which is loaded with a round .png picture.

    How do you put the round gradient out of drawable.xml?

    There must be a picture through the gradient.

    UPD:

    ImageView, I add the code on the screen:

    linearLayout.addView(imageView)
    

    ImageView requires a transparent gradient in this ImageView and cleans up at a certain time.

    The idea is, you can describe all the ImageView in the layout and put the ImageView in some l`yout, adding another ImageView with a gradient I'm gonna do when I press.

    How bad is that gonna be?

    The code as I add pictures:

    LinearLayout layout = (LinearLayout) findViewById(R.id.ll);
    for (int i = 0; i < 50; i++) {
        ImageView imageView = new ImageView(this);
        imageView.setId(i);
        imageView.setPadding(0, 0, 8, 0);
        imageView.setImageBitmap(BitmapFactory.decodeResource(
                    getResources(), R.drawable.pic1));
        imageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
        layout.addView(imageView);
    }
    


  • According to the https://stackoverflow.com/a/2470289/3212712 done by android:type="radial" so:

    <shape xmlns:android="http://schemas.android.com/apk/res/android"
        android:shape="rectangle">
        <gradient android:type="radial" android:gradientRadius="250"
            android:startColor="#88E9E9E9" android:endColor="#88D4D4D4" />
    </shape>
    

    Transparency https://stackoverflow.com/a/5647029/3212712 Coloured alpha-canal values. That's the first two figures.

    And so that the gradient is superficial, you can.

    1. Used https://ru.stackoverflow.com/a/475523/17609
    2. Put the picture in the background and the gradient as a picture. ImageView
    3. Or put it up. ImageView One more. ImageViewand put the gradient in any way.
    4. Turn it around, transfer both images to BitMap and put on a picel)



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2