I'd give it a try :) Thanks!
On Oct 5, 6:20 am, "Mark Murphy" <[email protected]> wrote: > > On Oct 4, 8:40 pm, "Mark Murphy" <[email protected]> wrote: > >> > I have a question about setting thebackgroundcolorfor buttons. > >> > When I am using btn.setBackgroundColor(Color.RED), the entire button > >> > turns into a red rectangle. > > >> Correct. > > >> > Is there actually a workaround to achieve this? > > >> What is "this"? > > > "this" refers to the intention to set the button with a Redbackground > >color. > > I actually meant to ask if there are any other ways to set the button > > with a Redbackgroundcolor. > > > :) > > Option #1: Use a redcolor, as you did there. Downside: your button will > appear to be no longer focusable or clickable, since the different button > UI states for those events are actually part of the buttonbackground. > > Option #2: Create a StateListDrawable, perhaps through a <selector> XML > file in res/drawable/. Clone the XML from the XML used by Android for > buttons by default, and replace whichever states you want with a solid > redcolor, or a red .9.png file, or something. > > -- > Mark Murphy (a Commons Guy)http://commonsware.com > Android App Developer Books:http://commonsware.com/books.html --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

