Removing the green Android indicator ToggleButton

I want my application to have a selector from the day of the week with the ability to select several days. I'm using ToggleButtons for this right now, but because the indicator lights up, ToggleButton takes up too much screen space. Without lights, my ToggleButtons would look like regular (toggleable) buttons, and they could fit on one line. How to hide the lights?

+7
source share
2 answers

The answer is:

android:background="@android:drawable/btn_default" 

For example, the following will cause the light to disappear, and the toggle button will look like the default button, but with a toggle function:

  <ToggleButton android:id="@+id/your_btn" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textOn="On" android:textOff="Off" android:background="@android:drawable/btn_default" /> 
+14
source

You can use custom android:background for them, which will override the graphics, including the indicator. If you look at Android: using frame images in a custom button selector , there are instructions on copying resources from the SDK to your own project. You could supposedly copy the normal platform button and use it as a background.

+1
source

All Articles