The difference between android:padding and Android:layout_margin has not been understood before, in fact the concept is very easy,padding to describe the narrative in the perspective of the parent view, which specifies that its contents must be within the bounds of the parent view. Margin is to stand in their own perspective to describe the narrative problem, and other (up and down) the distance between the view, assuming that the same level only has a view, then its effect is basically the same as padding. For example, my XML layout code is as follows:
<?xml version= "1.0" encoding= "Utf-8"? ><linearlayout xmlns:android= "http://schemas.android.com/apk/res/ Android "android:orientation=" vertical "android:layout_width=" fill_parent "android:layout_height=" Fill_parent " android:paddingleft= "10dip" android:paddingright= "10dip" android:paddingtop= "10dip" android:paddingbottom= "10dip "><textview android:layout_width=" wrap_content "android:layout_height=" Wrap_content "ANDROID:BACKGR" Ound= "#FF0000" android:text= "@string/hello" android:paddingleft= "50dip" android:paddingright= "50dip" android:p addingtop= "50dip" android:paddingbottom= "50dip" android:layout_marginbottom= "10dip"/> <textview androi D:layout_width= "Wrap_content" android:layout_height= "wrap_content" android:background= "#FF0000" android:text= "@ String/hello "android:paddingleft=" 50dip "android:paddingright=" 50dip "android:paddingtop=" 50dip "Android:padd Ingbottom= "50dip" Android:layout_marginbottom= "10dip"/> <textview android:layout_width= "wrap_content" android:layout_height= "Wrap_conte NT "android:background=" #FF0000 "android:text=" @string/hello "android:paddingleft=" 50dip "Android:paddingrigh t= "50dip" android:paddingtop= "50dip" android:paddingbottom= "50dip" android:layout_marginbottom= "10dip"/> <textview android:layout_width= "wrap_content" android:layout_height= "Wrap_content" android:background= "# FF0000 "android:text=" @string/hello "android:paddingleft=" 50dip "android:paddingright=" 50dip "Android:paddingt op= "50dip" android:paddingbottom= "50dip" android:layout_marginbottom= "10dip"/></linearlayout>Then I will get such as the following effect, the figure has been very clear the mark out of the difference.
The difference between padding and margin