Android Top和Bottom菜单

时间:2014-01-31 10:10:24

标签: android menu menubar

我是Android的新手,我没有太多的编程知识。我想为我的Android应用程序创建顶部和底部菜单。我附上了一张示例图片。请有人帮帮我

enter image description here

2 个答案:

答案 0 :(得分:1)

如何实现这样的目标有两种可能性:

1)使用拆分ActionBarmore information on the ActionBar

2)您可以在XML布局中自己定义它:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <LinearLayout
        android:id="@+id/top_menu"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true" >
    </LinearLayout>

    <!-- Your page-content can go here -->

    <LinearLayout
        android:id="@+id/bottom_menu"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true" >
    </LinearLayout>

</RelativeLayout>

答案 1 :(得分:0)

为顶部菜单栏设计两个自定义布局xml,为底部菜单栏设计一个。并在主xml中包含这些xml文件。然后调用自定义xml中的按钮,与从java文件中的main xml调用相同。

相关问题