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.
I want to make it like this
You can set a padding
paddingRight or paddingLeft
android:paddingLeft="5dp"
android:paddingTop="3dp"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.