Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to display background image in text view

Tags:

android

can anybody tell how to display background image in a TextView in android?

like image 867
mohan Avatar asked Sep 21 '10 10:09

mohan


People also ask

How to add background image and Text in Android studio?

add a android:background="@drawable/imagefile" attribute on your TextView tag. Before that you have to put your image file inside the res/drawable folder.


2 Answers

If you are working with xmls you can add it as Praveen Chandrasekaran said doing:

android:background="@drawable/myResouce" 

Before that you have to put your image file inside the res/drawable folder.

You can also change it from the code doing:

  mTextView.setBackgroundResource(R.drawable.myResouce); 
like image 196
Macarse Avatar answered Oct 11 '22 07:10

Macarse


add a android:background="@drawable/imagefile" attribute on your TextView tag. Before that you have to put your image file inside the res/drawable folder.

like image 25
Praveen Avatar answered Oct 11 '22 08:10

Praveen