本文整理匯總了Java中android.widget.Toolbar.setNavigationOnClickListener方法的典型用法代碼示例。如果您正苦於以下問題:Java Toolbar.setNavigationOnClickListener方法的具體用法?Java Toolbar.setNavigationOnClickListener怎麽用?Java Toolbar.setNavigationOnClickListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.widget.Toolbar
的用法示例。
在下文中一共展示了Toolbar.setNavigationOnClickListener方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onCreate
import android.widget.Toolbar; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_detail);
postponeEnterTransition();
TransitionSet transitions = new TransitionSet();
Slide slide = new Slide(Gravity.BOTTOM);
slide.setInterpolator(AnimationUtils.loadInterpolator(this,
android.R.interpolator.linear_out_slow_in));
slide.setDuration(getResources().getInteger(android.R.integer.config_shortAnimTime));
transitions.addTransition(slide);
transitions.addTransition(new Fade());
getWindow().setEnterTransition(transitions);
Intent intent = getIntent();
sharedElementCallback = new DetailSharedElementEnterCallback(intent);
setEnterSharedElementCallback(sharedElementCallback);
initialItem = intent.getIntExtra(IntentUtil.SELECTED_ITEM_POSITION, 0);
setUpViewPager(intent.<Photo>getParcelableArrayListExtra(IntentUtil.PHOTO));
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.setNavigationOnClickListener(navigationOnClickListener);
super.onCreate(savedInstanceState);
}
示例2: ActionBarDrawerToggle
import android.widget.Toolbar; //導入方法依賴的package包/類
/**
* In the future, we can make this constructor public if we want to let developers customize
* the
* animation.
*/
ActionBarDrawerToggle(Activity activity, Toolbar toolbar, DrawerLayout drawerLayout,
DrawerArrowDrawable slider, @StringRes int openDrawerContentDescRes,
@StringRes int closeDrawerContentDescRes) {
if (toolbar != null) {
mActivityImpl = new ToolbarCompatDelegate(toolbar);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (mDrawerIndicatorEnabled) {
toggle();
} else if (mToolbarNavigationClickListener != null) {
mToolbarNavigationClickListener.onClick(v);
}
}
});
} else if (activity instanceof DelegateProvider) { // Allow the Activity to provide an impl
mActivityImpl = ((DelegateProvider) activity).getDrawerToggleDelegate();
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
mActivityImpl = new JellybeanMr2Delegate(activity);
} /*else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
mActivityImpl = new IcsDelegate(activity);
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
mActivityImpl = new HoneycombDelegate(activity);
}*/ else {
mActivityImpl = new DummyDelegate(activity);
}
mDrawerLayout = drawerLayout;
mOpenDrawerContentDescRes = openDrawerContentDescRes;
mCloseDrawerContentDescRes = closeDrawerContentDescRes;
if (slider == null) {
mSlider = new DrawerArrowDrawable(mActivityImpl.getActionBarThemedContext());
} else {
mSlider = slider;
}
mHomeAsUpIndicator = getThemeUpIndicator();
}
示例3: initToolBar
import android.widget.Toolbar; //導入方法依賴的package包/類
private void initToolBar() {
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setActionBar(toolbar);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mDrawerLayout.openDrawer(mNavigationView);
}
});
}
示例4: initToolbar
import android.widget.Toolbar; //導入方法依賴的package包/類
private void initToolbar(Category category) {
mToolbar = (Toolbar) findViewById(R.id.toolbar_activity_quiz);
mToolbar.setTitle(category.getName());
mToolbar.setNavigationOnClickListener(mOnClickListener);
if (mSavedStateIsPlaying) {
// the toolbar should not have more elevation than the content while playing
mToolbar.setElevation(0);
}
}
示例5: setActionBar
import android.widget.Toolbar; //導入方法依賴的package包/類
@Override
@RequiresApi(21)
public void setActionBar(@Nullable Toolbar toolbar) {
super.setActionBar(toolbar);
if (null == toolbar)
return;
if (null == mToolbarListener) {
mToolbarListener = new ToolbarNavigationOnClickListener();
}
toolbar.setNavigationOnClickListener(mToolbarListener);
}
示例6: onCreate
import android.widget.Toolbar; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_detail);
postponeEnterTransition();
TransitionSet transitions = new TransitionSet();
Slide slide = new Slide(Gravity.BOTTOM);
slide.setInterpolator(AnimationUtils.loadInterpolator(this,
android.R.interpolator.linear_out_slow_in));
slide.setDuration(getResources().getInteger(android.R.integer.config_shortAnimTime));
transitions.addTransition(slide);
transitions.addTransition(new Fade());
getWindow().setEnterTransition(transitions);
Intent intent = getIntent();
sharedElementCallback = new DetailSharedElementEnterCallback(intent);
setEnterSharedElementCallback(sharedElementCallback);
try {
initialItem = Integer.parseInt(intent.getData().getLastPathSegment());
} catch (NumberFormatException e) {
initialItem = 0;
}
PhotoService.getInstance().getPhotosAsync(new PhotoService.PhotoCallback() {
@Override
public void success(ArrayList<Photo> photos) {
setUpViewPager(photos);
findViewById(android.R.id.empty).setVisibility(View.GONE);
}
@Override
public void error() {
finishAfterTransition();
}
});
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.setNavigationOnClickListener(navigationOnClickListener);
super.onCreate(savedInstanceState);
}