我正在尝试创建具有四个按钮的布局。
我已经设法显示了四个图像按钮,但我无法显示分隔线。在下图中,您可以看到我正在尝试设计的内容:
我正在尝试创建具有四个按钮的布局。
我已经设法显示了四个图像按钮,但我无法显示分隔线。在下图中,您可以看到我正在尝试设计的内容:
使用相对布局并首先添加 View 对象以分隔它们(见下文)。您必须添加所需的任何其他参数...
<RelativeLayout
android:layout_width = "match_parent"
android:layout_height = "match_parent">
<View
android:id = "@+id/vertical_divider"
android:layout_centerHorizontal = "true"
android:layout_width = "1dip"
android:layout_height = "match_parent">
</View>
<View
android:id = "@+id/horizontal_divider"
android:layout_centerVertical = "true"
android:layout_width = "match_parent"
android:layout_height = "1dip">
</View>
<ImageButton
android:layout_alignParentTop = "true"
android:layout_alignParentLeft = "true"
android:layout_toLeftOf = "@id/vertical_divider"
android:layout_above = "@id/horizontal_divider"
android:layout_width = "match_parent"
android:layout_height = "match_parent">
</ImageButton>
<ImageButton
android:layout_alignParentTop = "true"
android:layout_alignParentRight = "true"
android:layout_toRightOf = "@id/vertical_divider"
android:layout_above = "@id/horizontal_divider"
android:layout_width = "match_parent"
android:layout_height = "match_parent">
</ImageButton>
<ImageButton
android:layout_alignParentBottom = "true"
android:layout_alignParentLeft = "true"
android:layout_toLeftOf = "@id/vertical_divider"
android:layout_below = "@id/horizontal_divider"
android:layout_width = "match_parent"
android:layout_height = "match_parent">
</ImageButton>
<ImageButton
android:layout_alignParentBottom = "true"
android:layout_alignParentRight = "true"
android:layout_toRightOf = "@id/vertical_divider"
android:layout_below = "@id/horizontal_divider"
android:layout_width = "match_parent"
android:layout_height = "match_parent">
</ImageButton>
</RelativeLayout>
在你layout_marginBottom="1dip"
的.layout_marginRight="1dip"
Imageviews