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

annuaire recherche
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
personnages


ContextMenu

版本:Android 2.3 r1

?

結(jié)構(gòu)

繼承關(guān)系

public interface ContextMenu implements Menu

?

android.view.ContextMenu

?

類概述

?? ? 擴展自Menu的上下文菜單提供了修改上下文菜單頭(header)的功能。(譯者注:當(dāng)一個視圖注冊了上下文菜單時,執(zhí)行一個在該對象上長按(2秒)的動作,將出現(xiàn)一個具有相關(guān)功能的浮動菜單。)

?? ? 上下文菜單不支持菜單項的快捷方式和圖標(biāo)。

?? ? 當(dāng)執(zhí)行長按上下文菜單時,大多數(shù)情況會調(diào)用registerForContextMenu(View) 函數(shù)和重寫執(zhí)行onCreateContextMenu(ContextMenu, View, ContextMenu.ContextMenuInfo)函數(shù)。(譯者注:因為要創(chuàng)建一個上下文菜單,你必須重寫這個活動的上下文回調(diào)函數(shù)onCreateContextMenu() 并且 通過registerForContextMenu(View) 為其注冊上下文菜單。)

?

內(nèi)部類

???????? interface ?ContextMenu.ContextMenuInfo

獲得更多關(guān)于創(chuàng)建上下文菜單的信息。(?譯者注:例如:AdapterViews 使用這個類可以精確選擇adapter的位置來啟動上下文菜單。)

?

公共方法

???????? public abstract void clearHeader ()

清除上下文菜單頭的信息。(譯者注:包括圖片和文字信息

Menu.clearHeader();

?

public abstract ContextMenu setHeaderIcon (Drawable icon)

為上下文菜單頭設(shè)置圖標(biāo)

參數(shù)

icon ???????? 你要使用的Drawable

?????????????????? 返回值

調(diào)用你設(shè)置修改的上下文菜單

?

public abstract ContextMenu setHeaderIcon (int iconRes)

設(shè)置上下文菜單頭圖標(biāo)為指定的資源id

參數(shù)

iconRes ? 你要使用的圖標(biāo)資源的目錄

(譯者注:把圖標(biāo)放入res/drawable/ 目錄下,R文件會自動生成對應(yīng)項。設(shè)置方法如menu.setHeaderIcon(R.drawable.webtext)

這個上下文菜單頭是沒有設(shè)置圖標(biāo)的

???????? ??????

這個上下文菜單頭是設(shè)置了圖標(biāo)的?

?

返回值

調(diào)用你設(shè)置修改過的上下文菜單

?

?

public abstract ContextMenu setHeaderTitle (int titleRes)

通過資源標(biāo)識符為上下文菜單頭的標(biāo)題欄設(shè)置文字。(譯者注:需要在res/string中先設(shè)置一段你需要的文字,如:<string name="titletest">這是一段測試文字</string>

然后通過R文件索引到這段文字,menu.setHeaderTitle(R.string.titletest)

參數(shù)????

titleRes ? 所需文字資源的索引

?????????????????? 返回值

調(diào)用你設(shè)置修改過的上下文菜單

?

public abstract ContextMenu setHeaderTitle (CharSequence title)

設(shè)置上下文菜單的標(biāo)題,顯示在標(biāo)題欄

參數(shù)

title ???????? 標(biāo)題要顯示的文字

?????????????????? 返回值

調(diào)用你設(shè)置修改過的上下文菜單

?

?

public abstract ContextMenu setHeaderView (View view)

設(shè)置View 到上下文菜單頭上。將替代上下文菜單頭的圖標(biāo)和標(biāo)題(或者替代你之前設(shè)置的headerView

參數(shù)

view ??????? 上下文菜單頭要使用的 View

?????????????????? 返回值

調(diào)用你設(shè)置修改過的上下文菜單內(nèi)容

?

補充

???????? 文章精選:

?????????????????? Android 的上下文菜單: Context Menu

?????????????????? androidContextMenu

?????????????????? android 上下文菜單Context Menu

代碼示例:

Test_Contextmenu.java

public class Test_Contextmenu extends Activity {

???

??? @Override

??? public void onCreate(Bundle savedInstanceState) {

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

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

??????? TextView txt1 = (TextView) this.findViewById(R.id.txt1);

??????? this.registerForContextMenu(txt1);

??????? TextView txt2 = (TextView) this.findViewById(R.id.txt2);

??????? this.registerForContextMenu(txt2);

??? }?

??? // 重寫 onCreateContextMenu 用以創(chuàng)建上下文菜單

???? @Override

??? public void onCreateContextMenu(ContextMenu menu, View v,

??? ??? ContextMenuInfo menuInfo){

??? super.onCreateContextMenu(menu, v, menuInfo);

??? // 創(chuàng)建 R.id.txt1? 的上下文菜單

??? if (v == (TextView) this.findViewById(R.id.txt1)) {

??? ??? menu.setHeaderIcon(R.drawable.icon);

??? ??? menu.setHeaderTitle(R.string.titletest);

??? ??? //menu.clearHeader();

??? ??? // 第一個參數(shù):組ID

??? ??? // 第二個參數(shù):菜單項ID

??? ??? // 第三個參數(shù):順序號

??? ??? // 第四個參數(shù):菜單項上顯示的內(nèi)容

??? ??? menu.add(1,0,0,"菜單1");

??? ??? menu.add(1,1,1,"菜單2").setCheckable(true); // 增加一個√選項

??? ???

??? }

??? // 創(chuàng)建 R.id.txt2 的上下文菜單(多級)

??? else if(v == (TextView) this.findViewById(R.id.txt2)){

??? ???

??? // ContextMenu.addSubMenu("菜單名稱") - 用來添加子菜單。子菜單其實就是一個特殊的菜單

??? ??? SubMenu sub1 = menu.addSubMenu("父菜單1");

??? ??? sub1.setHeaderIcon(R.drawable.folder);

??? ??? sub1.add(0, 0, 0, "菜單1");

??? ??? sub1.add(0, 1, 1, "菜單2");

??? ??? sub1.setGroupCheckable(1, true, true);

??? ??? SubMenu sub2 = menu.addSubMenu("父菜單2");

??? ??? sub2.setIcon(R.drawable.text);

??? ??? sub2.add(1, 0, 0, "菜單3");

??? ??? sub2.add(1, 1, 1, "菜單4");

??? ??? sub2.setGroupCheckable(1, true, true);

??? }

??? }

}  

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:id="@+id/txt1"

??? android:layout_width="fill_parent"

??? android:layout_height="wrap_content"

??? android:text=" 發(fā)(txt1)"

??? />

??? <TextView

??? android:id="@+id/txt2"

??? android:layout_width="fill_parent"

??? android:layout_height="wrap_content"

??? android:text=" 發(fā)(txt2)"

??? />

???

</LinearLayout>

strings.xml

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

<resources>

??? <string name="hello">Hello World, Test_Contextmenu!</string>

??? <string name="app_name">Test_Contextmenu</string>

??? <string name="titletest">這是一段測試文字</string>

</resources>


Article précédent: Article suivant: