Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/jpa/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android中有没有不规则形状的按钮布局的例子?_Android_Layout - Fatal编程技术网

Android中有没有不规则形状的按钮布局的例子?

Android中有没有不规则形状的按钮布局的例子?,android,layout,Android,Layout,嗨,我想在安卓系统中制作一个用户界面,我想把四个圆形按钮放在一个菱形的队形中,彼此靠近。所以我不能将它们包含在正方形的网格中,否则它们会在单击时相互重叠 有人能给我指出一个教程或示例代码,其中有不规则形状的非方形按钮吗?那么一个仅仅用来固定按钮的表格布局呢。将TableLayout用作包装按钮的容器。然后将TableLayout锚定在需要按钮组的位置 PSUEDOCODE <TableLayout android:id="@+id/ButtonContainer" android

嗨,我想在安卓系统中制作一个用户界面,我想把四个圆形按钮放在一个菱形的队形中,彼此靠近。所以我不能将它们包含在正方形的网格中,否则它们会在单击时相互重叠


有人能给我指出一个教程或示例代码,其中有不规则形状的非方形按钮吗?

那么一个仅仅用来固定按钮的表格布局呢。将TableLayout用作包装按钮的容器。然后将TableLayout锚定在需要按钮组的位置

PSUEDOCODE

<TableLayout
  android:id="@+id/ButtonContainer"
  android:layout_width="3XButtonWidth"
  android:layout_height="3XButtonHeight"
  android:layout_alignParentBottom="OrWhereYouNeedIt"
  android:layout_alignParentRight="OrWhereYouNeedIt"
  >
  <TableRow
    android:id="@+id/FirstRow">
    <TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"/>
    <ImageButton
      android:id="@+/TopButton"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:AnyOtherParams="true"/>
    <TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"/>
 </TableRow>
 <TableRow
    android:id="@+id/MiddleRow">
    <ImageButton
      android:id="@+/LeftButton"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:AnyOtherParams="true"/>
    <TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"/>
    <ImageButton
      android:id="@+/RightButton"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:AnyOtherParams="true"/>
  </TableRow>
  <TableRow
    android:id="@+id/LastRow">
    <TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"/>
    <ImageButton
      android:id="@+/BottomButton"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:AnyOtherParams="true"/>
    <TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"/>
 </TableRow>
</TableLayout>

如果表格的宽度是按钮宽度的3倍,那么它就是一个标准网格,按钮之间的空间太大。我希望他们离得更近些。例如,该网格中四个单元格中的圆圈将使tablelayout=wrap\u内容的高度和宽度。我会稍后测试。我知道这是旧的,但找到解决方案了吗?我有一个类似的问题: