Questions tagged [android-togglebutton]

A toggle button allows the user to change a setting between two states.

A toggle button allows the user to change a setting between two states. It displays checked/unchecked states as a button with a "light" indicator and by default accompanied with the text "ON" or "OFF".

For more information, see the Toggle Buttons guide.

199 questions
0
votes
0 answers

I am working on a custom Listview for android that holds togglebutton (working on an alarm application)

The problem I am having is that the OnCheckedChangeListener is being called if I scroll, and randomly switching the toggle state for other items in the list. I have worked a way around this for now(loading the state for the toggle button from a…
0
votes
1 answer

Android list view: how to impose constraints between items of a list

I am implementing an Android app in which I have a list view. Each element of this list view has a toggle button and, using a custom adapter, which extends BaseAdapter, I managed to get which toggle buttons are checked and which are not…
rosekarma
  • 117
  • 1
  • 1
  • 12
0
votes
0 answers

Android Toggle Button notification

I am trying to set a toggle button that will enable and disable notification for the app i am building. The current code i have it set up for an old password field as I was using thenewboston Android Tutorial. This is My Current Code: package…
0
votes
1 answer

How to move the drawer icon left to right in action bar..?

I want to place that icon left to right side. Just want to know where should I change code?
Zin Win Htet
  • 2,448
  • 4
  • 32
  • 54
0
votes
2 answers

ToggleButtons in android

Hey guys I have a layout containing 4 toggle buttons.The first one is always enabled or is switched on.When I enable the second one,the remaining three should be switched off or disabled automatically.Same goes with the other remaining two.At…
AndroidMech
  • 1,676
  • 3
  • 20
  • 31
0
votes
2 answers

How to use ToggleButtons to determine what Counter to Add to

I have two integer variables which acts as a Counters and a button. I also have 2 Toggle Buttons which are linked so only 1 of them will be active at a time.When the Add button is clicked, i want to add 1 to the counter variable,based on the toggle…
0
votes
2 answers

How to Stop a Toggle Button from being deactivated by a click

I have 4 ToggleButtons set up in an OnCheckedChangeListener(). ToggleButton 1 is activated on startup and the listener is set so that when you press another ToggleButton within the checker, it deactivates the first button and then activates the…
kh_eden147
  • 43
  • 2
  • 9
0
votes
0 answers

Android- Put some texts on ToggleButton

I need to put 2 texts on ToggleButton, i.e. two different texts, so I could change just one of them. I don't want to put another TextView on the ToggleButton, because I need that the second text will looked as part of the button, and the location of…
user3114639
  • 1,895
  • 16
  • 42
0
votes
3 answers

Android imagebutton toggle click

I have imagebutton and I want to write setOnClickListener method with toggle click (like toggleButton). I know how working togglebutton but I do not need to use it. it is a possible to write toggleclick method in imagebutton. I wrote some code but…
user3775061
  • 145
  • 2
  • 11
0
votes
1 answer

Why doesn't the isEnabled for the ToggleButton work in Android?

I just defined a ToggleButton variable, found the view by the id, set activated to false, and set a OnClickListener. In the onClick method, I checked if it was enabled in a if statement. If it was enabled, then it should have logged it, but I…
user3764694
0
votes
1 answer

android-How to make custom toggle button

I want to make a custom toggle button , for instance when I click on the button , the star turns on and when I click again ,the star turns off. i've tried some codes but they change the button to an image and when I click on it ,the image changes .…
user3718930
  • 381
  • 1
  • 8
  • 19
0
votes
0 answers

Toggle button not showing well on tablet

I'm using two buttons in my list. One is a ToggleButton and the other is a regular ImageButton Here is how I've set it in the XML:
Anthony
  • 33,838
  • 42
  • 169
  • 278
0
votes
1 answer

Custom background for ToggleButton hides textOn and textOff

I'm styling ToggleButtons, and I got an image to use as the new background, for all 6 states (default on, default off, pressed on, pressed off, disabled on, disabled off) as 9-patches. The problem is that when applied the textOn and textOff…
SoManyGoblins
  • 5,605
  • 8
  • 45
  • 65
0
votes
1 answer

setOnItemLongClickListener not working after a togglebutton is placed in ListView

I am trying to implement a Custom adapter for ListView where I have two TextViews and a ToggleButton. Before the togglebutton I was able to use setOnItemLongClickListener which I can not now and I know that focus is on togglebutton so is the issue.…
Saty
  • 2,563
  • 3
  • 37
  • 88
0
votes
1 answer

togglebutton state changes when listview is scrolled down in android?

i have placed a textview and a toggle button into a list view by using the following xml file and i have used an arrayadapter to set it on to my layout, my problem is when i scroll down in the list view by unchecking a few toggle buttons (which are…