1. 옵션메뉴 항목 설정 : res/menu/quick.xml
2. 옵션 메뉴 구현
<menu xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@+id/home" android:title="Home" android:orderInCategory="1"></item> <item android:id="@+id/exit" android:title="Exit" android:orderInCategory="2"></item> <item android:id="@+id/cook1" android:title="Cook1" android:orderInCategory="3"></item> <item android:id="@+id/cook2" android:title="Cook2" android:orderInCategory="4"></item> <item android:id="@+id/cook3" android:title="Cook3" android:orderInCategory="5"></item> </menu>
2. 옵션 메뉴 구현
public class BlogTest extends Activity { ......... // OptionMenu public boolean onCreateOptionsMenu(Menu menu){ getMenuInflater().inflate(R.menu.quick, menu); return true; } // OptionMenu click event public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.exit: finish(); return true; case R.id.cook1: startActivity(new Intent(this, Sample00.class)); return true; case R.id.cook2: startActivity(new Intent(this, Sample01.class)); return true; } return false; } }
'Programming > Android' 카테고리의 다른 글
[Android]안드로이드 DDMS 사용하기 & 이클립스에서 DDMS 사용하기!!! (0) | 2010.04.26 |
---|---|
[Android] #8 Intent (0) | 2010.04.08 |
[Android] #7 Activity & Task (0) | 2010.03.31 |
[Android] #6 Android Application (0) | 2010.03.30 |
[Android] #5 ADB(Android Debug Bridge) (0) | 2010.03.30 |