Android的padding和margin区别

来源:互联网 发布:linux 修改profile 编辑:程序博客网 时间:2024/05/01 01:47
<Button        android:paddingLeft="50dp"        android:id="@+id/button1"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:text="paddingLeft" />    <Button        android:layout_marginLeft="50dp"        android:id="@+id/button2"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:text="layout_marginLeft" />


结论:

paddingLeft:是距离控件最左边的长度

layout_marginLeft:是整个控件距离左边的长度

0 0