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
4
votes
3 answers

Unable to create a ToggleButton in Eclipse IDE for android

In my android XML Graphical Layout, it can not display my ToggleButton. I get some errors (see below). I have checked all other components in the Palette window and the only component that fails to load is ToggleButton. The problem is not project…
Pranit Bankar
  • 453
  • 1
  • 7
  • 21
3
votes
1 answer

How we can remove ripple effect from toggle button in jetpack compose?

I have the toggle button in android jetpack compose, I want to remove ripple effect, when I click the toggle buttons. I try to find a solution on internet, but I did not find clear solution for this kind of example. Is there any idea? …
user10991969
3
votes
1 answer

How to make customized Material Toggle Button?

I want to customized Material Toggle Button like the following. I have tried but not succeed to achieve this output. following is xml code I tried but not desired output. I go through the Offical Documents but no help about this. Please help me if…
3
votes
4 answers

Change the background color of MaterialButtonToggleGroup

I'm using MaterialButtonToggleGroup to create selector buttons. I want to change the background color of MaterialButton buttons. Its default color is light blue, and I want to change it to light green. Currently, I'm using drawable sectors to change…
3
votes
3 answers

Create MaterialButtonToggleGroup including MaterialButton(s) with customized style programmatically in Android

I'm trying to create a MaterialButtonToggleGroup with material buttons inside it and I wanna do that with custom styles. I was able to create that using xml, however, I need to achieve the same result programmatically here's what I did with xml…
3
votes
3 answers

How to make a button remain selected even after release?

I'm trying to make a button stay clicked after a user chooses it. My program is a 10 question quiz where if a user chooses an option and then return to that question, it should be displayed as chosen. I can't seem to figure out a way to display the…
3
votes
1 answer

create favourite button using toogleButton

i'm trying to add a favourite button using toogleButton that displays a certain icon when unchecked and another icon when checked. I tried this but isn't working. Here is the toggleButton
3
votes
2 answers

Restore state of toggle button on canceling dialog

I have a toggle button in my activity. When switch is On, it shows enable dialog and switch is Off, it shows disable dialog. ((SwitchCompat) findViewById(R.id.toggleButton)).setOnCheckedChangeListener(new OnCheckedChangeListener() { …
Raj
  • 41
  • 10
3
votes
1 answer

Check state of togglebutton android

Im new to android and I don't get the code on the developers website about this really, I just want to check if the state of the toggle button is on or off. I have the following scenario if (isCheckedToggleButton?) { // do something …
Reshad
  • 2,570
  • 8
  • 45
  • 86
2
votes
1 answer

setOnClickListener for ToggleButton/CheckBox in not working in ListView?

I want a check box or toggle button in listView, and set onclicklisterner but it works only for zero position, here is my code String[] NewTransferItems = { "Spendability", "Accounts", "Budgets", "I'm keeping" }; and dashboardEditListView =…
Chatar Veer Suthar
  • 15,541
  • 26
  • 90
  • 154
2
votes
0 answers

Android Firestore Toggle Button reverting back to false state with button selectors

I'm trying to make my first project on my own. it's basically a stack overflow replica. I am currently at the part where I'm trying to get the "checked answer" mark to show up green whenever someone views a question if an answer has been selected.…
2
votes
1 answer

Change switch icon color from java code

I want to change the 'switch' icon color from java code and not from xml since the switch is created dynamically. Min SDK is 16. Help would be highly appreciated. Switch aSwitch = new Switch(context); holder.llSwitch.addView(aSwitch); …
Aparajita Sinha
  • 514
  • 1
  • 10
  • 21
2
votes
2 answers

Getting State of Toggle Button in Android

I am trying to make a list view in which every item has two things, a description in textview and a toggle button. The details in the textview are dynamically loaded by the AsyncTask. At the end of the listview, I have inserted a button…
2
votes
2 answers

Android Toggle Button - Background Color

I'm trying to use a Toggle Button, supporting back to API 11. The problem is this standard Toggle Buttom seems to have a greyish background color, while I just want it to be white (like the background). I've been…
CounterFlame
  • 1,612
  • 21
  • 31
2
votes
1 answer

Android ListView with toggle button

I'm having a problem when my ListView has more itens that can appear on the screen; in other words, when it gets scroll. The problem is, when I click in one of the toggle buttons, it's change the visibility of the ImageView. However, when I click on…
Tarcisiofl
  • 151
  • 4
  • 12
1
2
3
13 14