502/108
Android-How to create an option menu
This post learned from http://www.droidnova.com/how-to-create-an-option-menu,427.html,
droidnova.com is very good site about Android dev,.
Today we learn how you can create an option menu for your application.
Lets start with an empty android project. The package name will be com.droidnova.android.howto.optionmenu and the activity will have the name SimpleOptionMenu.
Our activity should now look very familiar to us:
package com.droidnova.android.howto.optionmenu;
import android.app.Activity;
import android.os.Bundle;
public class SimpleOptionMenu extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
First we have to make a new folder in our res/ directory named menu. In this new directory we will create a new xml file named menu.xml.
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/icon"
android:icon="@drawable/icon" />
<item android:id="@+id/text"
android:title="Text" />
<item android:id="@+id/icontext"
android:title="Icon and text"
android:icon="@drawable/icon" />
</menu>
Tagged as: onCreateOptionsMenu
Continue reading
Categories
- AIR+FB+AS3 (157)
- Android (22)
- Demo (71)
- fDEV (3)
- Flash AS2 (65)
- Game (17)
- jQuery (14)
- Others (93)
- PHP (42)
- Wordpress (60)
Recent Comments
- MRFISH says under Flex/AS3/Air参考书籍及小工具真好啊,正好我也在学Flash,不错额
- [...] 接着嘛,是万用数据库查询函数,记住不是query_posts()而是WP_Query()...
- DFdou says under AS3-Caurina 动画类import caurina.transitions.Tweener; import caurin...
- DFdou says under Android-Permission V1.0:jrjr
- DFdou says under AS3-Captcha验证码类@太阴真人, HI,可以提供下具体是第几行报的错么
- 太阴真人 says under AS3-Captcha验证码类1084: 语法错误: rightparen 应在 semicolon 之前。 1084: 语法...
- DFdou says under Air-fWeather Google Weather Api使用例子@soluo, 是这个没错,这个数据的确是乱七八糟的,不是很准确~
- soluo says under Air-fWeather Google Weather Api使用例子博主,您好,请教您一个Google Weather Api的问题: 我用Google Weather...
- Anonymous says under Android-ListView用法:dahan
- DFdou says under Android-一些常用技巧手动调用MEDIA_SCANNER: Intent intent = new Intent(Inte...
Blogroll
Archive
- March 2010 (4)
- February 2010 (13)
- January 2010 (9)
- December 2009 (19)
- November 2009 (23)
- October 2009 (17)
- September 2009 (22)
- August 2009 (13)
- July 2009 (20)
- June 2009 (18)
- May 2009 (18)
- April 2009 (29)
- March 2009 (31)
- February 2009 (46)
- January 2009 (37)
- December 2008 (16)
- November 2008 (12)
- October 2008 (21)
- September 2008 (10)
- August 2008 (12)
- July 2008 (14)
- June 2008 (8)
- May 2008 (11)