-2

Whenever i am using transparent PNG images, on my android device ( nexus ), i get a border on one side of transparent part. What is the way to sort out this problem ?

Vishwas
  • 1,533
  • 2
  • 19
  • 40

1 Answers1

0

The image you are trying to add may not be transparent.Check it...

In the xml file, use this code to add an ImageView and set a resource for it:

<ImageView
 android:id="@+id/image"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:src="@drawable/sample" />

To access the ImageView from the java code ,use the following code.

 ImageView imgView = (ImageView) findViewById(R.id.image);

You can also set a resource programatically:

 imgView.setImageResource(R.drawable.sample);
Philipp Jahoda
  • 50,880
  • 24
  • 180
  • 187
Darish
  • 11,032
  • 5
  • 50
  • 70