Reputation: 928
I want my ToggleButton to like like this .
But with this code , it always shows me the older toggle button.
Am running the code in Emulator with API 21 only, Am I missing something here. My code snippet is
<ToggleButton
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
Upvotes: 0
Views: 2051
Reputation: 961
Use Switch instead of toggle button you will get what u need. No need for external libraries
Upvotes: 0
Reputation: 928
Found a solution.
Using Android support library. Code snippet is..
<android.support.v7.widget.SwitchCompat
android:id="@+id/id_useridview_switch"
android:layout_marginTop="24dp"
android:layout_width="wrap_content"
android:layout_height="2dp"
android:theme="@style/colortoggle"
/>
Thanks Selvin, got a clue from ur and on what to search
Upvotes: 6
Reputation: 3
In this code you just set the width and height of your toggle button! for Android L toggle button you should use support libraries to achieve that! google something like these:
android L Toggle button support libraries Also search in Github.com
Upvotes: 0