如何创建自定义的Andr​​oid选项菜单 [英] How to create custom option menu in android

查看:127
本文介绍了如何创建自定义的Andr​​oid选项菜单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建一个选项菜单。它有三个选项,主页,电邮,请访问。所有三个选项未来在同一行。我必须表现出高于主页选项,并休息了下面主页选项(根据所附截屏)。

I am creating an option menu. it has three option HOME, EMAIL, VISIT. All three options coming at the same row. i have to show HOME option above and rest two below to Home Option(according to attached Screen Shot).

任何想法? 谢谢你。

下面是我的XML文件。

Here is my XML file.

<menu android:id="@+id/new_game"
          android:icon="@drawable/red_no_bg"
          android:title="Home" />
    <item android:id="@+id/email"
          android:icon="@drawable/red_no_bg"
          android:title="Email" />
    <item android:id="@+id/help"
          android:icon="@drawable/red_no_bg"
          android:title="Visit Microsite" />
</menu>

下面是我的code。

@Override
    public boolean onCreateOptionsMenu(Menu menu) {
        MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.layout.overview_menu, menu);
        return true;
    }

使用上述$ C $词我得到在同一行中的所有选项。

Using the above code i am getting the all option in Same line.

推荐答案

请参阅本极好来源$ C ​​$ C ............

See this excellent source code..................

在此源有五个菜单,你还有3集,按您的requre ...

in this source there are five menu and you have three set as per your requre...

<一个href="http://www.$c$cproject.com/KB/android/AndroidMenusMyWay.aspx">http://www.$c$cproject.com/KB/android/AndroidMenusMyWay.aspx

这篇关于如何创建自定义的Andr​​oid选项菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆