[SwitchMaterial] On-Off state are not vertically aligned
See original GitHub issueDescription: By using multiple SwitchMaterial components in multiple rows you will see they are not vertically aligned when one of them is on and another is off.
Expected behavior:
I think that thumb of SwitchMaterial should stand in a position (in both on/off) that looks vertically aligned like this image (created by a photo editing app) :
Current implementation of SwitchMaterial does not consider vertical alignment as you see:
Source code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity">
<com.google.android.material.switchmaterial.SwitchMaterial
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:checked="true" />
<com.google.android.material.switchmaterial.SwitchMaterial
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp" />
</LinearLayout>
Android API version: 29
Material Library version: 1.1.0
Device: All devices, also in design mode of android studio
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:9 (2 by maintainers)
Top Results From Across the Web
Alignment vertical the switch on Android - Stack Overflow
I am trying to create a layout (Android Studio) in which I need to vertically align various controls like Switch in below screenshot....
Read more >Switch (On/Off) Tutorial With Example In Android Studio
It is basically an off/on button which indicate the current state of Switch. It is commonly used in selecting on/off in Sound, Bluetooth,...
Read more >Switch class - material library - Flutter - Dart API docs
Used to toggle the on/off state of a single setting. The switch itself does not maintain any state. Instead, when the state of...
Read more >Switch | Android Developers
A Switch is a two-state toggle widget. Users can drag the switch "thumb" back and forth to select either of two options or...
Read more >Switch in Kotlin - GeeksforGeeks
Android Switch is also a two-state user interface element that is used ... android:gravity, Used to specify how to align the text like...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @angdesign Based on your last update I was wondering if you know any more about when this change might be implemented. I couldn’t spot this on the first alpha for version 1.4.0, so I was wondering if this might be later added to this version or if it will be a bit later down the line for version 1.5.0 or onwards?
Following up, acknowledging the staggered effect, and we have an update in the works for Switches to align toggle position to follow the pattern below.