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
2
votes
1 answer

Switch button not showing up in ActionBar?

I have a Switch that I placed into my ActionBar, but it doesn't seem to show up and I don't see why. This was my attempt: create_post_menu.xml
user1871869
  • 3,317
  • 13
  • 56
  • 106
2
votes
1 answer

ToggleButton on Android 6: setCompoundDrawables doesn't work

I've this code for put a drawable to the right of a ToggleButton text: ToggleButton myToggle = (ToggleButton) v.findViewById(R.id.filtro_stat); Drawable drawable = getResources().getDrawable(R.drawable.a010_ico); drawable.setBounds(0, 0, (int)…
giozh
  • 9,868
  • 30
  • 102
  • 183
2
votes
0 answers

Why is onCheckedChanged not responding?

I have so far the following code for that allows me to set a value to a textview when I click between toggle buttons that are grouped in a radiogroup. For some reason, it seems like the OnCheckedChanged does not get called. Is this the appproach for…
2
votes
1 answer

Is there a way to programmatically set src image for ToggleButton?

I am using a ToggleButton with an image. The image is 16x16, however, I want the button to be 50x50 so that when users click around the image even then the action is taken. This is how I'm avoiding the fat finger problem. This is how my…
Anthony
  • 33,838
  • 42
  • 169
  • 278
1
vote
1 answer

how to design jetpack compose toggle buttons for week days

I have design below toggle buttons in xml Toggle button
1
vote
1 answer

How we can use toggle button for per row in jetpack compose?

I am try to learn jetpack compose, and I have a text row in my screen, I want to use toggle button for per row, but I am not sure, how can I add toggle button in this project, I know how to add image button, but I am not sure how implement toggle…
user10991969
1
vote
0 answers

Custom ToggleButton icon moving to corner after state change in Android

I'm considerably new to Android and I'm trying to implement a custom ToggleButton in Android with help of tag. When I'm not toggling the button, the icon is perfectly centered (icon size -> 32dp x 32dp ). But after toggling the button…
stardep
  • 129
  • 1
  • 13
1
vote
1 answer

What is the error in my custom drawer navigation toolbar?

My application crashes as soon as I try to link my custom toolbar with ActionBarDrawerToggle. Following is my code: package com.example.customnavdrawerapp; import androidx.annotation.NonNull; import…
1
vote
1 answer

How to move the image inside the toggle button next to the text?

I'm making a toggle button that changes the unit as the button is pressed. I put an image on the toggle button. I used the drawableLeft property to put an image on the toggle button. (The image inside the toggle button is a temporary…
ybybyb
  • 1,385
  • 1
  • 12
  • 33
1
vote
1 answer

Material Button Toggle Group not visible

I am trying to use Material toggle group in an existing application. I found that it works (visible) only when the application is using Material components theme. Since the existing application is using Theme.AppCompat.Light and I cannot change the…
1
vote
0 answers

How to check the Install Unknown Apps Toggle is on / off dynamically in Android

I have added the below code for redirecting to the Install Unknown Apps Screen run time using Settings.ACTION_MANAGE_UNKNOWN_APP_SOURCES. But how do I check the Toggle button is On or Off? I need to download the APK file if Install Unknown Resouces…
1
vote
2 answers

Toggle Button View Retains State

In one of my App's fragments the layout uses a toggle button defined as:
1
vote
1 answer

How to get checked button position in Android MaterialButtonToggleGroup

I have defined an MaterialButtonToggleGroup with 2 MaterialButton in my xml, in this way:
1
vote
1 answer

How do I checked the material toggle button when the application is opened?

I choose a theme using the toggle button.my goal is to have the theme_light toggle button selected when the app is first opened.I keep the state of the themes with SharedPreferencs because I use the recreate () function in the app. here are my…
UgurGul
  • 45
  • 7
1
vote
2 answers
1 2
3
13 14