當前位置: 首頁>>代碼示例>>Java>>正文


Java OnNavigationListener類代碼示例

本文整理匯總了Java中com.actionbarsherlock.app.ActionBar.OnNavigationListener的典型用法代碼示例。如果您正苦於以下問題:Java OnNavigationListener類的具體用法?Java OnNavigationListener怎麽用?Java OnNavigationListener使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


OnNavigationListener類屬於com.actionbarsherlock.app.ActionBar包,在下文中一共展示了OnNavigationListener類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onCreate

import com.actionbarsherlock.app.ActionBar.OnNavigationListener; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_list_style);

    ActionBar actionBar = getSupportActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);

    ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
            android.R.layout.simple_list_item_1);
    for (int i = 0; i < 5; i++) {
        adapter.add("item" + i);
    }
    actionBar.setListNavigationCallbacks(adapter,
            new OnNavigationListener() {
                @Override
                public boolean onNavigationItemSelected(int itemPosition,
                        long itemId) {
                    Toast.makeText(This(), "pos" + itemPosition,
                            Toast.LENGTH_SHORT).show();
                    return false;
                }
            });
}
 
開發者ID:android-opensource-library-56,項目名稱:android-opensource-library-56,代碼行數:25,代碼來源:ListStyleActivity.java

示例2: onCreate

import com.actionbarsherlock.app.ActionBar.OnNavigationListener; //導入依賴的package包/類
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	mContext = getActivity();
	misc  = new Miscellaneous(mContext);
	actionbar= getSherlockActivity().getSupportActionBar();
	actionbar.setDisplayShowTitleEnabled(false);

	SpinnerAdapter mSpinnerAdapter = new MySpinnerAdapter(mContext);
	
	OnNavigationListener mOnNavigationListener = new OnNavigationListener() {

		@Override
		public boolean onNavigationItemSelected(int position, long itemId) {
			if(position == 0) {

			}
			else if (position == 1) {
				scrollToToday();
				persistCurrentTab();
				Log.d(myTag,"Scrolling to Today");
				return true;
			}

			return true;
		}
	};

	actionbar.setListNavigationCallbacks(mSpinnerAdapter, mOnNavigationListener);
}
 
開發者ID:dakshit,項目名稱:upes-academics,代碼行數:30,代碼來源:TimeTablePagerFragment.java

示例3: onCreate

import com.actionbarsherlock.app.ActionBar.OnNavigationListener; //導入依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_main);

	final ActionBar ab = getSupportActionBar();
	final String[] menulist = getResources().getStringArray(
			R.array.sections);

	// set defaults for logo & home up
	ab.setDisplayHomeAsUpEnabled(false);
	ab.setDisplayUseLogoEnabled(false);
	ab.setDisplayShowTitleEnabled(false);
	ab.setDisplayShowHomeEnabled(false);

	// set up list nav
	ab.setListNavigationCallbacks(ArrayAdapter.createFromResource(this,
			R.array.sections, R.layout.sherlock_spinner_dropdown_item),
			new OnNavigationListener() {
				public boolean onNavigationItemSelected(int itemPosition,
						long itemId) {
					displayFragment(itemPosition);
					return false;
				}
			});

	ab.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);

}
 
開發者ID:museumsvictoria,項目名稱:mv-fieldguide-android,代碼行數:30,代碼來源:MainActivity.java

示例4: setCallback

import com.actionbarsherlock.app.ActionBar.OnNavigationListener; //導入依賴的package包/類
public void setCallback(OnNavigationListener callback) {
    mCallback = callback;
}
 
開發者ID:treasure-lau,項目名稱:CSipSimple,代碼行數:4,代碼來源:ActionBarView.java


注:本文中的com.actionbarsherlock.app.ActionBar.OnNavigationListener類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。