Android : custom toggle button with image and text

on Monday, September 15, 2014


I want to create a toggle button with image on the left of the text. I use this code to make the image on the left:



<ToggleButton
android:textOn="Like"
android:textOff="Liked"
android:drawableLeft="@drawable/tggle_btn_like"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="false"
/>


However the image is too big. If I set the layout_width and layout_height to a value, the image doens't scale accordingly. My question is how to set with and height for the left drawable of a toggle.


enter image description here


I want to make it like this


enter image description here


0 comments:

Post a Comment