Try moving the elements in the XML around a bit.

Try to think of your selector as a big if-else.



- Zarah.



On Sep 29, 11:13 am, Vinay <vinay.rav...@siemens.com> wrote:
> Dear all,
>
> Thank you for the suggestions.
>
> @ Niko, Zahar: Thanks for helping me understand better.
>
> @nishu: Things seem to be working. The image does change when fouced.
> BUT preseed state still doesn't seem to be reflecting. This test was
> carried out on the emulator. The changes can be noticed only when used
> keyborad. (Normal and Focused states only)
>
> In case the application is ported on any of the embedded systems, can
> the changes be seen with touch screen. Further, why isn't the changes
> when used mouse with the emulator ???
>
> Thank you all.
>
> Vinay.
>
> On Sep 27, 5:56 pm, nishu <nishuk...@gmail.com> wrote:
>
>
>
> > try this
>
> > <?xml version="1.0" encoding="utf-8"?>
> > <selector xmlns:android="http://schemas.android.com/apk/res/android";>
> > <!-- Button Focused-->
> >     <item   android:state_focused="true"
> >             android:state_pressed="false"
> >             android:drawable="@drawable/login_hover"
> >             />
> > <!-- Button Focused Pressed-->
> >     <item   android:state_focused="true"
> >             android:state_pressed="true"
> >             android:drawable="@drawable/login_hover"
> >             />
> > <!-- Button Pressed-->
> >     <item   android:state_focused="false"
> >             android:state_pressed="true"
> >             android:drawable="@drawable/login_hover"
> >             />
> > <!-- Button Default Image-->
> >     <item   android:drawable="@drawable/login_bg"/>
>
> > </selector>
>
> > On Sep 26, 6:11 pm, niko20 <nikolatesl...@yahoo.com> wrote:
>
> > > The only thing I can think of is that the drawables in the selector
> > > are taken in the order in which listed in the XML. So it it finds a
> > > "match" for the state it will grab the first entry it finds in order.
>
> > > The other thing worth trying is to put two of these buttons on a
> > > dialog and then test. Then you can see if you are having a problem
> > > with the "focused" state.
>
> > > -niko
>
> > > On Sep 24, 12:02 am, Vinay <vinay.rav...@siemens.com> wrote:> The image 
> > > button background never changes (normal, focused, clicked.)
>
> > > > I'm using an image button and trying to different background image
> > > > when normal, focused and clicked. I have read quite a lot of posts
> > > > related to this and have implemented exactly as suggested. My code
> > > > below:
>
> > > > In main.xml: (this is just a part of my main.xml)
> > > > <ImageButton android:id="@+id/ImageButton01"
> > > >         android:layout_width="wrap_content"
> > > > android:layout_height="wrap_content"
> > > >         android:background="@drawable/fm" android:clickable="true"
> > > >         android:focusable="true" android:layout_margin="10px">
> > > > </ImageButton>
>
> > > > fm.xml: (in folder drawable)
> > > > <?xml version="1.0" encoding="utf-8"?>
> > > > <selector
> > > >   xmlns:android="http://schemas.android.com/apk/res/android";>
> > > >   <!-- Default State -->
> > > >   <item android:drawable="@drawable/fm_rest"/>
>
> > > >   <!-- Focused State -->
> > > >   <item android:state_focused="true"
> > > >         android:drawable="@drawable/fm_focus"/>
>
> > > >   <!-- Pressed State -->
> > > >   <item android:state_pressed="false"
> > > >         android:drawable="@drawable/fm_press"/>
>
> > > >   <!-- Focused Pressed State -->
> > > >   <item android:state_focused="true"
> > > >         android:state_pressed="true"
> > > >         android:drawable="@drawable/fm_press"/>
> > > > </selector>
>
> > > > Kindly let me know if I'm missing some thing.
>
> > > > Also kindly let me know will the focus works in the emulator when
> > > > focused using mouse.
>
> > > > Thank you.- Hide quoted text -
>
> > - Show quoted text -

-- 
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

Reply via email to