Toggle button with more states that two

by Duskox » Fri, 11 Mar 2011 01:51:50 GMT


Sponsored Links
 I am trying to find if there is a possibility to use togglebutton in
such a way to have more states that two? So I want a single button to
change appearance (background image) depending on what state it is in.
So if I have states 1, 2, 3, 4, 5 and off to be able to change between
all those states and display a new image for every state.

Thanks!
D.

-- 



Re: Toggle button with more states that two

by Justin Anderson » Fri, 11 Mar 2011 02:01:08 GMT


 I don't think so, but it shouldn't be too hard to just subclass the Button
class and implement this behavior yourself.

Thanks,
Justin Anderson
MagouyaWare Developer
 http://sites.google.com/site/magouyaware 






-- 


Sponsored Links


Re: Toggle button with more states that two

by mort » Fri, 11 Mar 2011 14:58:18 GMT


 I think this would also break the user experience. Better use a
spinner. You can show different "foreground" images if you use proper
layouts and adapter.
For both button and spinner you could simply set a new button
background when the item has changed, i.e. in the OnClick- or
OnItemSelectedListener.
However, I don't think background images (at least if they still
should look like common button surfaces) are quite intuitive, esp. not
with so many states.
Depending on your screen layout, it might also be a good idea to
simply show an icon and/or text with prev./next state arrow buttons or
tabs. I for one wouldn't like to press a button 5 times to get to the
previous state again...

-- 



Re: Toggle button with more states that two

by Duskox » Mon, 14 Mar 2011 21:54:24 GMT


 Thanks for your suggestions. What I want to do is a button that will
have an off state and then a repeat all state and repeat single state.
Like in any mp3 player where you can loop the whole playlist, single
song or no loop.

I'll check spinner out and then if that is not what I want go to
create a subclass.

Thanks,
D.

-- 



Other Threads

1. my slider is broke

Is there a way of adjusting the software (or with a tool) to disable
the function of going from portrait to landscape mode with the slider?
I want my phone to stay in portrait and then when I turn the phone it
can go to landscape mode. So, only the slider-function should be
disabled.


Grtz

--~--~---------~--~----~------------~-------~--~----~

2. Notification Volume

Hi all. I'm wondering if you could help me? I've had a look through
the existing posts and can't find what I'm looking for, but I
apologise if it's been covered.

I'm looking for code to do the following: -

Toggle the "use incoming call volume for notifications" to false
Set the notification volume.

Thanks in advance.

--~--~---------~--~----~------------~-------~--~----~

3. Sending sms via intents launches only the compose window

4. Getting a reference to the View corresponding to the id passed to setContentView()

5. Sdk update Problem

6. Android instrumentation class : what is the concept ?

7. XML iteration on android