Slightly off-topic, but thanks for the 'Drawable mutations' blog post anyways. :)
On May 6, 7:18 pm, Romain Guy <romain...@google.com> wrote: > It's default state is transparent actually :) > > > > On Wed, May 6, 2009 at 9:10 AM, Jeff Sharkey <jshar...@android.com> wrote: > > > So the list_selector_drawable is a stateful drawable, where it's > > default state is black. (This is why ListView unselected items are > > transparent/black.) The default button drawable is also stateful, but > > it's default state is an unpressed button. > > > You could force it into a focused state using Drawable.setState() > > before setting it to the background. > > > However, keep in mind that you probably don't want to have the > > TextView always appear selected, as it might confuse users to see two > > selected areas on screen at once. > > > You might instead try setting the TextView to be focusable, so the > > background changes automatically whenever the user moves focus to the > > TextView. > > > j > > > On Wed, May 6, 2009 at 5:57 AM, gsmd <gsm...@gmail.com> wrote: > > >> Ok, here's a simple 'helloorange' activity: > >> -- > >> �...@override > >> public void onCreate(Bundle savedInstanceState) { > >> super.onCreate(savedInstanceState); > >> TextView tv = new TextView(this); > >> tv.setText("some text"); > >> tv.setBackgroundDrawable(getResources().getDrawable > >> (android.R.drawable.list_selector_background)); > >> setContentView(tv); > >> } > >> -- > >> When running this, the background doesn't change it's color. When I > >> change to android.R.drawable.btn_default, it works. > >> So, how do I apply orange background drawable to a TextView at > >> runtime? > > >> TIA. > > > -- > > Jeff Sharkey > > jshar...@google.com > > -- > Romain Guy > Android framework engineer > romain...@android.com > > Note: please don't send private questions to me, as I don't have time > to provide private support. All such questions should be posted on > public forums, where I and others can see and answer them --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---