开发者

Any examples of irregular shaped button layout in Android?

Hi I'm looking to make a UI in Android, where I'm thinking of putting four circular buttons in a diamond formation close to e开发者_运维技巧ach other. So I can't have them contained in a grid of squares or they'd overlap each other onclick.

Can anybody point me to a tutorial or example code that has irregular shaped (non-square) buttons?


What about a TableLayout just to hold the buttons. Use the TableLayout as a container to wrap your buttons in. Then anchor the TableLayout where you want the button group.

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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜