本文整理匯總了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);
}
示例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);
}
示例4: setCallback
import com.actionbarsherlock.app.ActionBar.OnNavigationListener; //導入依賴的package包/類
public void setCallback(OnNavigationListener callback) {
mCallback = callback;
}