亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

Verzeichnis suchen
android Manifest Manifest.permission Manifest.permission_group android.accessibilityservice AccessibilityService android.accounts Account android.app NotificationManager android.bluetooth BluetoothAdapter BluetoothClass BluetoothClass.Device BluetoothClass.Device.Major BluetoothClass.Service BluetoothDevice BluetoothServerSocket BluetoothSocket android.content SharedPreferences android.database.sqlite SQLiteCursorDriver SQLiteOpenHelper android.graphics Bitmap android.location LocationListener Geocoder GpsStatus GpsStatus.Listener GpsStatus.NmeaListener GpsSatellite android.media AudioFormat AsyncPlayer AudioRecord AudioRecord.OnRecordPositionUpdateListener ThumbnailUtils AudioManager android.net TrafficStats MailTo LocalSocket android.os AsyncTask AsyncTask.Status CountDownTimer Message MessageQueue HandlerThread android.text Html android.util JsonWriter android.view ContextMenu ContextMenu.ContextMenuInfo Display ViewManager View ViewStub ViewTreeObserver ViewParent WindowManager GestureDetector Gravity MenuInflater ScaleGestureDetector SoundEffectConstants android.view.inputmethod InputConnection InputMethod InputMethodSession BaseInputConnection InputMethodManager android.widget AbsListView AbsListView.LayoutParams AbsListView.OnScrollListener AbsListView.RecyclerListener AbsoluteLayout AbsoluteLayout.LayoutParams AbsSeekBar AbsSpinner AdapterView AdapterView.AdapterContextMenuInfo AdapterView.OnItemLongClickListener AdapterView.OnItemSelectedListener AdapterView.OnItemClickListener AnalogClock BaseAdapter BaseExpandableListAdapter Button CheckBox CheckedTextView Checkable Chronometer Chronometer.OnChronometerTickListener CompoundButton CompoundButton.OnCheckedChangeListener CursorAdapter CursorTreeAdapter DatePicker DatePicker.OnDateChangedListener DialerFilter DigitalClock EditText Filter Filter.FilterListener Filter.FilterResults ExpandableListAdapter ExpandableListView.OnChildClickListener ExpandableListView.OnGroupClickListener ExpandableListView.OnGroupCollapseListener ExpandableListView.OnGroupExpandListener Filterable Gallery Gallery.LayoutParams GridView GridLayout GridLayout.Alignment RadioGroup ImageView ImageView.ScaleType HorizontalScrollView ImageButton ImageSwitcher FilterQueryProvider ListAdapter ListView MediaController MultiAutoCompleteTextView MultiAutoCompleteTextView.CommaTokenizer MultiAutoCompleteTextView.Tokenizer QuickContactBadge RadioButton RatingBar RatingBar.OnRatingBarChangeListener RelativeLayout RemoteViews ResourceCursorAdapter ResourceCursorTreeAdapter Scroller ScrollView SearchView SearchView.OnCloseListener SearchView.OnQueryTextListener SearchView.OnSuggestionListener SeekBar SeekBar.OnSeekBarChangeListener SimpleAdapter SimpleAdapter.ViewBinder SimpleCursorAdapter SimpleCursorAdapter.CursorToStringConverter SimpleCursorAdapter.ViewBinder SimpleCursorTreeAdapter SimpleCursorTreeAdapter.ViewBinder SimpleExpandableListAdapter SlidingDrawer SlidingDrawer.OnDrawerCloseListener SlidingDrawer.OnDrawerOpenListener SlidingDrawer.OnDrawerScrollListener Spinner SpinnerAdapter WrapperListAdapter TabHost TabHost.TabSpec TextView TimePicker TimePicker.OnTimeChangedListener Toast TableLayout TableLayout.LayoutParams TableRow TableRow.LayoutParams TabWidget TextSwitcher ToggleButton TwoLineListItem VideoView ViewAnimator ViewFlipper ViewSwitcher ViewSwitcher.ViewFactory ZoomButtonsController ZoomButtonsController.OnZoomListener ZoomButton ZoomControls dalvik.system DexFile
Figuren


MenuInflater

版本:Android 2.3 r1

結(jié)構(gòu)

繼承關(guān)系

public class MenuInflater extends Object

????????

java.lang.Object

android.view.MenuInflater

子類及間接子類

直接子類

TabActivity

?

概述

這個(gè)類是用來(lái)實(shí)例化菜單XML文件成菜單對(duì)象。

由于性能的原因,由于程序創(chuàng)建時(shí)候就加載一些預(yù)處理XML文件,Menu過(guò)多就造成很重的負(fù)擔(dān)。因此,這是目前無(wú)法在運(yùn)行時(shí)使用多于一個(gè)XmlPullParserxml文件去使用MenuInflater,它只能使用一個(gè)XmlPullParser返回的編譯過(guò)的資源(R.某些文件)

?

構(gòu)造函數(shù)

???????? public MenuInflater (Context context)

構(gòu)造填充(inflater)一個(gè)菜單

參見(jiàn)

getMenuInflater()

?

公共方法

???????? public void inflate (int menuRes, Menu menu)

菜單層次從一個(gè)指定的xml資源去填充,如果有錯(cuò)誤會(huì)拋擲InflateException。

參數(shù)

menuRes ??????? 要加載XML布局文件中的資源ID(例如R.menu.main_activity

menu ????? 要填充的菜單,這些項(xiàng)目和子菜單就被添加到要填充菜單中

補(bǔ)充

文章精選

MenuInflater Android菜單從xml創(chuàng)建方法

???????? AndroidMenuInflater實(shí)例

???????? Android MenuInflater的使用(布局定義菜單)

示例代碼

新建一個(gè)android2.2的項(xiàng)目,項(xiàng)目文件列表

MenuInfalterTest.java

public class MenuInflaterTest extends Activity {

??? @Override

??? public void onCreate(Bundle savedInstanceState) {

?????? super.onCreate(savedInstanceState);

?????? setContentView(R.layout.main);

??? }

?

??? public boolean onCreateOptionsMenu(Menu menu) {

?????? // 獲取當(dāng)前的菜單

?????? MenuInflater inflater = getMenuInflater();

?????? // 填充菜單

?????? inflater.inflate(R.menu.option_menu, menu);

?????? return true;

??? }

?

???

??? public boolean onOptionsItemSelected(MenuItem item) {

?????? switch (item.getItemId()) {

?????? case R.id.menu_add:

?????????? break;

?????? case R.id.menu_wallaper:

?????????? break;

?????? case R.id.menu_search:

?????????? break;

?????? case R.id.menu_setting:

?????????? showSettings();

?????????? break;

?????? }

?????? return super.onOptionsItemSelected(item);

??? }

?

???

??? private void showSettings() {

?????? Intent settings = new Intent

?????? (android.provider.Settings.ACTION_SETTINGS);

?????? settings.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK

????????????? | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);

?????? startActivity(settings);

??? }

}

}

?

Main.xml

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

??? android:orientation="vertical"

??? android:layout_width="fill_parent"

??? android:layout_height="fill_parent"

??? >

<TextView?

??? android:layout_width="fill_parent"

??? android:layout_height="wrap_content"

??? android:text="@string/hello"

??? />

</LinearLayout>

?

Option_menu.xml

<?xml version="1.0" encoding="utf-8"?>?

<menu xmlns:android="http://schemas.android.com/apk/res/android">?

??? <item android:id="@+id/menu_add"?

??????? android:title="Add"?

??????? android:icon="@android:drawable/ic_menu_add"/>?

???? <item android:id="@+id/menu_wallaper"?

??????? android:title="Wallpaper"?

??????? android:icon="@android:drawable/ic_menu_gallery"/>?

??? <item ?android:id="@+id/menu_search"?

??????? android:title="Search"?

??????? android:icon="@android:drawable/ic_search_category_default"/>?

??? <item? android:id="@+id/menu_setting"?

??????? android:title="Settings"?

????? android:icon="@android:drawable/ic_menu_preferences"/>? ???????????????????????????</menu>?

?


Vorheriger Artikel: N?chster Artikel: