1
使用它们可以使用的元素相对于其他元素进行对齐。Android对齐元素+相对于父元素的边距
android:layout_alignLeft
等。
但是如何添加余量或一个填充:
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:text="@string/students"
android:textSize="30sp"
android:typeface="normal"
android:layout_marginTop="10dp"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:id="@+id/student" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@id/student"
android:paddingLeft="20dp"
android:paddingTop="30dp"
android:text="@string/stud_describe"
android:textSize="10sp"
android:textStyle="italic"
android:typeface="sans" />
</RelativeLayout>
填充顶部的第二TextView
不具有任何影响。
是的,添加填充将使b =填充在textview的顶部和文本的内部部分之间。而边距将在文本视图的顶部和其上方项目的底部之间留出空间。一个简单的方法来看看你在做什么时,要做的是给你的textview背景颜色。 – WallMobile