本文整理了Java中android.support.v4.widget.DrawerLayout.setDrawerLockMode()
方法的一些代码示例,展示了DrawerLayout.setDrawerLockMode()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DrawerLayout.setDrawerLockMode()
方法的具体详情如下:
包路径:android.support.v4.widget.DrawerLayout
类名称:DrawerLayout
方法名:setDrawerLockMode
[英]Enable or disable interaction with all drawers.
This allows the application to restrict the user's ability to open or close any drawer within this layout. DrawerLayout will still respond to calls to #openDrawer(int), #closeDrawer(int) and friends if a drawer is locked.
Locking drawers open or closed will implicitly open or close any drawers as appropriate.
[中]启用或禁用与所有抽屉的交互。
这允许应用程序限制用户在此布局中打开或关闭任何抽屉的能力。如果抽屉被锁定,抽屉布局仍将响应对#openDrawer(int)、#closeDrawer(int)和朋友的调用。
锁定抽屉打开或关闭将根据情况隐式打开或关闭任何抽屉。
代码示例来源:origin: MindorksOpenSource/android-mvp-architecture
@Override
public void lockDrawer() {
if (mDrawer != null)
mDrawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
}
代码示例来源:origin: MindorksOpenSource/android-mvp-architecture
@Override
public void unlockDrawer() {
if (mDrawer != null)
mDrawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);
}
代码示例来源:origin: MindorksOpenSource/android-mvp-architecture
@Override
protected void onResume() {
super.onResume();
if (mDrawer != null)
mDrawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);
}
代码示例来源:origin: k9mail/k-9
public void unlock() {
drawer.getDrawerLayout().setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);
}
}
代码示例来源:origin: k9mail/k-9
public void lock() {
drawer.getDrawerLayout().setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
}
代码示例来源:origin: TeamNewPipe/NewPipe
private void updateDrawerNavigation() {
if (getSupportActionBar() == null) return;
final Toolbar toolbar = findViewById(R.id.toolbar);
final DrawerLayout drawer = findViewById(R.id.drawer_layout);
final Fragment fragment = getSupportFragmentManager().findFragmentById(R.id.fragment_holder);
if (fragment instanceof MainFragment) {
getSupportActionBar().setDisplayHomeAsUpEnabled(false);
if (toggle != null) {
toggle.syncState();
toolbar.setNavigationOnClickListener(v -> drawer.openDrawer(GravityCompat.START));
drawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNDEFINED);
}
} else {
drawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
toolbar.setNavigationOnClickListener(v -> onHomeButtonPressed());
}
}
代码示例来源:origin: palaima/DebugDrawer
/**
* Enable or disable interaction with all drawers.
*
* @return
*/
public void setDrawerLockMode(int lockMode) {
if (drawerLayout != null && sliderLayout != null) {
drawerLayout.setDrawerLockMode(lockMode);
}
}
代码示例来源:origin: syncthing/syncthing-android
/**
* Handles various dialogs based on current state.
*/
@Override
public void onServiceStateChange(SyncthingService.State currentState) {
switch (currentState) {
case STARTING:
break;
case ACTIVE:
getIntent().putExtra(this.EXTRA_KEY_GENERATION_IN_PROGRESS, false);
showBatteryOptimizationDialogIfNecessary();
mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);
mDrawerFragment.requestGuiUpdate();
// Check if the usage reporting minimum delay passed by.
Boolean usageReportingDelayPassed = (new Date().getTime() > getFirstStartTime() + USAGE_REPORTING_DIALOG_DELAY);
RestApi restApi = getApi();
if (usageReportingDelayPassed && restApi != null && !restApi.isUsageReportingDecided()) {
showUsageReportingDialog(restApi);
}
break;
case ERROR:
finish();
break;
case DISABLED:
break;
}
}
代码示例来源:origin: syncthing/syncthing-android
mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
mDrawerLayout.addDrawerListener(mDrawerToggle);
setOptimalDrawerWidth(findViewById(R.id.drawer));
代码示例来源:origin: listenzz/AndroidNavigation
@Override
public void run() {
if (drawerLayout != null) {
drawerLayout.setDrawerLockMode(lockMode);
}
}
});
代码示例来源:origin: Fueled/flowr
@Override
public void setDrawerEnabled(boolean enabled) {
binding.drawerLayout.setDrawerLockMode(enabled ? DrawerLayout.LOCK_MODE_UNLOCKED :
DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
}
}
代码示例来源:origin: MindorksOpenSource/android-mvp-interactor-architecture
@Override
public void lockDrawer() {
if (mDrawer != null)
mDrawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
}
代码示例来源:origin: MindorksOpenSource/android-mvp-interactor-architecture
@Override
public void unlockDrawer() {
if (mDrawer != null)
mDrawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);
}
代码示例来源:origin: wasdennnoch/AndroidN-ify
void updateDrawerLock() {
if (mDrawerAdapter.getItemCount() != 0) {
mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);
} else {
mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
}
}
代码示例来源:origin: CypherpunkArmory/UserLAnd
@Override
public void copyModeChanged(boolean copyMode) {
// Disable drawer while copying.
mActivity.getDrawer().setDrawerLockMode(copyMode ? DrawerLayout.LOCK_MODE_LOCKED_CLOSED : DrawerLayout.LOCK_MODE_UNLOCKED);
}
代码示例来源:origin: MindorksOpenSource/android-mvp-interactor-architecture
@Override
protected void onResume() {
super.onResume();
if (mDrawer != null)
mDrawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);
}
代码示例来源:origin: beczesz/FragmentNavigationPatternDemo
/**
* Enables/disbales the drawer the drawer
*
* @param isEnabled
*/
public void enableDrawer(boolean isEnabled) {
if (mDrawer != null) {
mDrawer.getDrawerLayout().setDrawerLockMode(isEnabled ? DrawerLayout.LOCK_MODE_UNLOCKED : DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
}
}
代码示例来源:origin: QDqiaodong/Reader
@Override
public void onDrawerClosed(View drawerView) {
super.onDrawerClosed(drawerView);
mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
}
};
代码示例来源:origin: QDqiaodong/Reader
@Override
public void onDrawerOpened(View drawerView) {
super.onDrawerOpened(drawerView);
mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);
}
代码示例来源:origin: gigabytedevelopers/FireFiles
public void setInfoDrawerOpen(boolean open) {
if(!mShowAsDialog){
setRootsDrawerOpen(false);
if (open) {
mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED, mInfoContainer);
mDrawerLayout.openDrawer(mInfoContainer);
} else {
lockInfoContainter();
}
}
}
内容来源于网络,如有侵权,请联系作者删除!