start android
start android

Reputation: 323

how set runtime background image in textview in android?

i want to set runtime background in textview in android here you can see i have a one image which is runtime set this is not fix so i want to change runtime background in textview and current location in text with different color

 holder.textmenu.setBackgroundDrawable(R.Drawable.imagename) // gives error
 holder.textmenu.setBackgroundColor(R.color.color_orange);`

enter image description here

Upvotes: 2

Views: 5172

Answers (2)

Surya
Surya

Reputation: 21

To set an image as your textview backgrouhnd use youtextview.setBackgroundResource(R.drawable.yourimage);

Upvotes: 0

Aashish Bhatnagar
Aashish Bhatnagar

Reputation: 2605

It should be

holder.textmenu.setBackgroundResource(R.Drawable.imagename)

Upvotes: 2

Related Questions