android:background - Set an Image as Background on a TextView, using background

How to Set an Image as Background on a TextView, using background

Note: This will set the background of a TextView to your image. If text, you can still see the text. The image expands the textview to remaining view of the device. It will resize the picture so you can see the whole picture on your device.

1. Create an Android project, if you don't already have one.

2. Add a TextView.

3. Add your image to res\drawable directory. 

3. In the main.xml file, add the below line

  <TextView
    ....
      android:background = "@drawable/myImage" 
  />
 
5. Compile and run!

Related Articles



Resources: