Hi Farproc,

Could you please provide a sample code or a link to a sample code for
the same?????

Thanks,
Shoby


On Oct 16, 3:04 pm, Farproc <[email protected]> wrote:
> Set button's background to a StateListDrawable object or xml resource.
>
> Here is a sample to use StateListDrawable resource. It's very easy you
> event do not need to write the listeners!!!
>
> On 10月16日, 下午5时43分, Shoby <[email protected]> wrote:
>
> > Hi i am developing an application that has a button whose color should
> > change green color on focusing on the button and the color of button
> > should change to red on clicking the button. I am using
> > setBackgroundResource() in the onClick and onLongClick listeners.
> > Though it changes the button color, it also changes the button shape
> > by making it look like a rectangle. How can this be solved?  i have
> > used the below code to do the same:
>
> > final Button b = (Button)findViewById(R.id.Button01);
> >         b.setOnLongClickListener(new View.OnLongClickListener(){
>
> >                         public boolean onLongClick(View v) {
> >                                 b.setBackgroundResource(R.color.green);
> >                                 return false;
> >                         }
> >         });
>
> >        b.setOnClickListener(new View.OnClickListener() {
> >             public void onClick(View view) {
> >                 b.setBackgroundResource(R.color.red);
> >             }
>
> >         });
>
> > How can i achieve the functionality with out changing the shape of the
> > button????
> > Can someone tell me how this functionality can be achieved?
>
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to