Android使用FrameLayout xml具有不同布局位置的多个按钮
我不熟悉安卓系统 我在玩风景画。我在屏幕中央有文字。我在文本的正下方有两个按钮(False和True),然后我尝试在屏幕的左下角有一个previous image按钮,在屏幕的右下角有一个next image按钮 问题是,由于FrameLayout中有多个布局,我无法使“下一个”和“上一个”按钮分开并位于屏幕底部的相对角落 如何修改XML重力布局属性来实现这一点?我一直把两个图像按钮都贴在最左边的每个按钮旁边Android使用FrameLayout xml具有不同布局位置的多个按钮,android,xml,button,mobile,imagebutton,Android,Xml,Button,Mobile,Imagebutton,我不熟悉安卓系统 我在玩风景画。我在屏幕中央有文字。我在文本的正下方有两个按钮(False和True),然后我尝试在屏幕的左下角有一个previous image按钮,在屏幕的右下角有一个next image按钮 问题是,由于FrameLayout中有多个布局,我无法使“下一个”和“上一个”按钮分开并位于屏幕底部的相对角落 如何修改XML重力布局属性来实现这一点?我一直把两个图像按钮都贴在最左边的每个按钮旁边 图像按钮是线性布局的子项线性布局如果不在部分子视图上使用属性android:layo
图像按钮是
线性布局的子项<代码>线性布局
如果不在部分子视图上使用属性android:layout\u weight
,则永远不会使用所有可用空间。我在这里不解释如何执行此操作,因为放弃LinearLayout
并让ImageButton
s成为FrameLayout
的子项对性能更有利:
</FrameLayout>
<!-- other Views like before ... -->
<ImageButton
android:id="@+id/prev_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/arrow_left"
android:layout_gravity="left|bottom"
android:contentDescription="@string/prev_button" />
<ImageButton
android:id="@+id/next_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right|bottom"
android:contentDescription="@string/next_button"
android:src="@drawable/arrow_right" />
</FrameLayout>
</FrameLayout>
<!-- other Views like before ... -->
<ImageButton
android:id="@+id/prev_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/arrow_left"
android:layout_gravity="left|bottom"
android:contentDescription="@string/prev_button" />
<ImageButton
android:id="@+id/next_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right|bottom"
android:contentDescription="@string/next_button"
android:src="@drawable/arrow_right" />
</FrameLayout>