3 개의 LinearLayouts를 구성하려고합니다. 하나는 왼쪽으로, 다른 하나는 오른쪽으로, 3 번째는 양쪽에 같은 양의 공백이있는 두 개의 LinearLayouts입니다. 나는 이것을 달성하기 위해 이것을 RelativeLayout으로 감싸고 있다고 생각한다. 그런 다음 한 레이아웃을 alignParentLeft로 설정하고 두 번째 레이아웃을 alignParentRight로 설정합니다. 하지만 3 번째 레이아웃에서는 layout_marginLeft = (RelativeLayout.width - (layout1.width + layout2.width + layout3.width))/2를 설정하고 싶습니다. 비록, 나는 XML에서 이것을하는 방법을 보지 못했다. 어떤 제안?Android : RelativeLayout 내의 균등 한 간격의 구성 요소는 무엇입니까?
* 편집. 제안에 따라 LinearLayout을 사용하고 있습니다. 이것은 작업에 가깝지만 3 개의 레이아웃은 균등하지 않으며 올바른 레이아웃은 오른쪽 정렬되지 않습니다. 아래는 내 xml입니다 :
<LinearLayout
android:id="@+id/toolbar"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:paddingTop="4dip"
android:paddingBottom="4dip"
android:background="#50000000"
android:visibility="visible">
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_weight="1"
android:layout_height="wrap_content">
<ImageButton
android:id="@+id/open"
android:src="@drawable/open"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</ImageButton>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_weight="1"
android:layout_height="wrap_content">
<ImageButton
android:id="@+id/prev"
android:src="@drawable/prev"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</ImageButton>
<TextView
android:id="@+id/totalpages"
android:text="0 of 0"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#FFFFFFFF">
</TextView>
<ImageButton
android:id="@+id/next"
android:src="@drawable/next"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</ImageButton>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_gravity="right"
android:layout_width="wrap_content"
android:layout_weight="1"
android:layout_height="wrap_content">
<ImageButton
android:id="@+id/zoomout"
android:src="@drawable/zoomout"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</ImageButton>
<ImageButton
android:id="@+id/zoomin"
android:src="@drawable/zoomin"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</ImageButton>
</LinearLayout>
</LinearLayout>
그냥 LinearLayout (LinearLayout 내의 3 개의 LinearLayout)을 사용하여 모든 너비를 fill_parent로 설정하고 안쪽에 3 개의 레이아웃 'android : layout_weight = "1"'을 지정합니다. – kcoppock
고마워요, 이건 나를 가까이 가졌지 만 제게는 효과가 없습니다. 이렇게하면 3 개의 선형 레이아웃이 모두 동일한 크기가되지만, 선형 레이아웃은 다른 내용을 갖습니다. 내 편집을 참조하십시오. – ab11
그래서 세 개의 버튼이 있고 그 세 개의 버튼의 너비가 같지 않다고 추측합니다. 이것은 까다로운 사건이 될 것입니다. 모든 버튼이 잘 보이고 잘리지 않도록 이미지 크기를 낮추라고 제안합니다. 예를 들어 트위터/페이스 북 앱을보십시오. 그럴 수 없다면 각 버튼의 최소 너비를 결정하고 [화면 크기에 따라 너무] 지정하십시오. 그 이후에 내가 제안 할 수있는 것은 주위를 둘러보고 무엇이 자신에게 가장 적합한지를 확인하는 것입니다. – achie