안드로이드 레이아웃에서 3 개의 객체를 가로로 정렬하려면 첫 번째 객체가 왼쪽에 정렬되어야하고 세 번째 객체가 오른쪽에 나타나야하고 두 번째 객체가 가운데에 나머지 너비를 가져야합니다.안드로이드 레이아웃에서 3 개의 객체를 수평으로 설정하는 방법
어떻게 만들 수 있습니까?
안드로이드 레이아웃에서 3 개의 객체를 가로로 정렬하려면 첫 번째 객체가 왼쪽에 정렬되어야하고 세 번째 객체가 오른쪽에 나타나야하고 두 번째 객체가 가운데에 나머지 너비를 가져야합니다.안드로이드 레이아웃에서 3 개의 객체를 수평으로 설정하는 방법
어떻게 만들 수 있습니까?
합니다. TextView를 원하는보기로 바꾸면됩니다. 크리스마스이기 때문에 배경을 빨강으로 만들었습니다.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView" android:background="#f00"/>
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="TextView" android:background="#f00"/>
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:text="TextView" android:background="#f00"/>
</LinearLayout>
가로 방향의 선형 레이아웃이 필요합니다. 그 후 당신의 세 개의 객체를 선언하고 그들에게 일 각각의 가중치를 부여 : 안드로이드 : 이것은 꽤 많이 당신이 원하는 무엇에 layout_weight = "1"
왜 투표를 했습니까? – Adham
귀하의 질문에 연구 노력이 나타나지 않았기 때문에. 이것은 거의 모든 곳에서 문서화 된 기본적인 Android 제품입니다. –
왼쪽 및 오른쪽 오브젝트에 상대적 레이아웃 및 중력을 사용하십시오. –