In Android app development, you sometimes use the status button (which is not the same as when you can click on a non-clickable background), and the button size required by the product is fixed. The text of the button on a different phone may appear to be abnormal (mainly when the background of the button is very easy to appear), how do we deal with it at this time? We can use the Padding property.
Look at the small example:
--------------------------just a button, but background is a state selector written in an XML file--------------------------------
<button
android:id= "@+id/publish_starlist_achieve_btn"
Android:layout_width= "300DP"
android:layout_height= "44DP"
android:layout_centerinparent= "true"
Android oid:layout_gravity= "Bottom"
android:layout_margin= "10DP"
android:background= "@drawable/common_btn_selector"
& nbsp android:text= "release"
android:textcolor= "#FFFFFF"
android:textsize= "16sp"/>
------------------------------common_btn_selector,android:state_enabled Different, corresponding drawable different--------------------------------
<?xml version= "1.0" encoding= "Utf-8"?>
<selector xmlns:android= "Http://schemas.android.com/apk/res/android" >
<item android:drawable= "@drawable/common_btn_normal" android:state_enabled= "false"/>
<item android:drawable= "@drawable/common_btn_press" android:state_pressed= "true"/>
<item android:drawable= "@drawable/common_btn_normal"/>
</selector>
In this case, in the Xiaomi 3, Xiaomi 4 and other mainstream mobile phone display no task problems, but in the cool 8297D and other models on the "release" 2 words are not displayed, and then layout file button layout added a sentence android:padding= "0DP", the problem solved.
Padding uses a little trick in Android development