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.


    ImageView, I add the code on the screen:


    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(;
    for (int i = 0; i < 50; i++) {
        ImageView imageView = new ImageView(this);
        imageView.setPadding(0, 0, 8, 0);
                    getResources(), R.drawable.pic1));

  • According to the done by android:type="radial" so:

    <shape xmlns:android=""
        <gradient android:type="radial" android:gradientRadius="250"
            android:startColor="#88E9E9E9" android:endColor="#88D4D4D4" />

    Transparency Coloured alpha-canal values. That's the first two figures.

    And so that the gradient is superficial, you can.

    1. Used
    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