0

i want to set the below xml code programmatically. i know about textView.setBackgroundResource(R.drawable...) but i am not able to set textView background to @android:drawable/dialog_holo_light_frame. Please suggest me suitable method.

android:background="@android:drawable/dialog_holo_light_frame"

3 Answers3

1

Try to use the pattern of the code below:

textView.setBackgroundResource(android.R.drawable.dialog_holo_light_frame);
Mohsen Bahman
  • 1,092
  • 3
  • 15
  • 27
0

If you want to use and of the standard android resources you have to use android.R. folder rather than just R. . R. is for your own project. So do it like below -

textView.setBackgroundResource(android.R.drawable.dialog_holo_light_frame);
Kapil G
  • 4,081
  • 2
  • 20
  • 32
0

You can do like below:

yourTextView.setBackgroundResource(android.R.drawable.dialog_holo_light_frame);
Manishoaham
  • 601
  • 1
  • 5
  • 14
  • 2
    This answer is practically identical to at least **2** previous ones. What does it add to them? – Phantômaxx Jul 29 '17 at 07:48
  • It's due to latency in StackOverflow server as well as in internet connection of mine, in addition with how long before had I opened the question in explorer, so. – Manishoaham Jul 29 '17 at 07:58
  • 1
    For your information, I didn't downwote. The one who appreciated my comment is *supposed* to have done that. – Phantômaxx Jul 29 '17 at 08:03