1
다른 요소와 관련하여 요소를 정렬하려면 해당 요소를 사용할 수 있습니다.안드로이드 - 부모 요소에 상대적으로 요소 + 마진 맞추기
android:layout_alignLeft
등
하지만 어떻게 마진이나 패딩 추가하는 방법 : 두 번째 TextView
에
<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 = 패딩이 생깁니다. 반면 여백은 텍스트 뷰의 위쪽과 위쪽의 항목 사이에 공백을줍니다. 아웃 배치 할 때 무엇을하는지 쉽게 볼 수있는 방법은 텍스트 뷰에 배경색을 지정하는 것입니다. – WallMobile