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
听说你要找我?
- QQ:104357575
- Gmail:k5angle9527@gmail.com
Categories
- AIR+FB+AS3 (169)
- Android (28)
- Demo (78)
- fDEV (3)
- Flash AS2 (66)
- Game (22)
- iPhone (1)
- jQuery (14)
- Others (95)
- PHP (43)
- Wordpress (60)
Recent Comments
- Anonymous says under Discuz!验证码总是错误:wuwu :xizao :wuwu :wenhao :touxiang :shuaya ...
- Anonymous says under 有关Flash 8 Video Encoder无法启动的问题:chaocai :shengtian 高级感谢~~~我找了一个晚上了,嗨哭命呀! 不过幸好...
- DFdou says under AS3-留言板(GuestBook)更新@DFdou, :leilei 这样啊,thx 哦
- lightoy says under AS3-留言板(GuestBook)更新@DFdou, a...不要把amfphp里面的.htaccess文件上传即可~_!
- Anonymous says under Android-ListView用法:zhuang
- DFdou says under AS3-留言板(GuestBook)更新@Lightoy, amfphp和.htaccess不会有冲突啊
- DFdou says under GAME-NamePK 基于MD5的名字PK(上)@, 随意~~
- Anonymous says under jQuery-each(fn)的使用:loveu :leilei :kua
- Lightoy says under AS3-留言板(GuestBook)更新hi,你好,因为wordpress生成的.htaccess文件导致测试amfphp时产生了500 I...
- Anonymous says under GAME-NamePK 基于MD5的名字PK(上):shengtian 博主我可以弄走做个养成pk游戏么?
Blogroll
Archive
- August 2010 (3)
- July 2010 (3)
- June 2010 (3)
- May 2010 (4)
- April 2010 (4)
- March 2010 (8)
- 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)