Reputation: 323
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);`
Upvotes: 2
Views: 5172
Reputation: 21
To set an image as your textview backgrouhnd use youtextview.setBackgroundResource(R.drawable.yourimage);
Upvotes: 0
Reputation: 2605
It should be
holder.textmenu.setBackgroundResource(R.Drawable.imagename)
Upvotes: 2