本文整理了Java中com.mikepenz.materialdrawer.Drawer.setSelectionAtPosition()
方法的一些代码示例,展示了Drawer.setSelectionAtPosition()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Drawer.setSelectionAtPosition()
方法的具体详情如下:
包路径:com.mikepenz.materialdrawer.Drawer
类名称:Drawer
方法名:setSelectionAtPosition
[英]set the current selection in the drawer NOTE: This will trigger onDrawerItemSelected without a view!
[中]在抽屉中设置当前选择注意:这将触发onDrawerItemSelected而不显示视图!
代码示例来源:origin: mikepenz/MaterialDrawer
/**
* set the current selection in the drawer
* NOTE: This will trigger onDrawerItemSelected without a view!
*
* @param position the position to select
*/
public boolean setSelectionAtPosition(int position) {
return setSelectionAtPosition(position, true);
}
代码示例来源:origin: mikepenz/MaterialDrawer
setOnDrawerItemLongClickListener(onDrawerItemLongClickListener);
setItems(drawerItems, true);
setSelectionAtPosition(drawerSelection, false);
代码示例来源:origin: FreedomZZQ/YouJoin-Android
/**
* set the current selection in the drawer
* NOTE: This will trigger onDrawerItemSelected without a view!
*
* @param position the position to select
*/
public boolean setSelectionAtPosition(int position) {
return setSelectionAtPosition(position, true);
}
代码示例来源:origin: FreedomZZQ/YouJoin-Android
/**
* set the current selection in the drawer
* NOTE: This will trigger onDrawerItemSelected without a view!
*
* @param drawerItem
*/
public boolean setSelection(@NonNull IDrawerItem drawerItem) {
return setSelectionAtPosition(getPosition(drawerItem), true);
}
代码示例来源:origin: FreedomZZQ/YouJoin-Android
/**
* set the current selection in the drawer
* NOTE: This will trigger onDrawerItemSelected without a view if you pass fireOnClick = true;
*
* @param drawerItem
* @param fireOnClick
*/
public boolean setSelection(@NonNull IDrawerItem drawerItem, boolean fireOnClick) {
return setSelectionAtPosition(getPosition(drawerItem), fireOnClick);
}
代码示例来源:origin: FreedomZZQ/YouJoin-Android
/**
* set the current selection in the drawer
* NOTE: This will trigger onDrawerItemSelected without a view!
*
* @param identifier
*/
public boolean setSelection(int identifier) {
return setSelectionAtPosition(getPosition(identifier), true);
}
代码示例来源:origin: FreedomZZQ/YouJoin-Android
/**
* set the current selection in the drawer
* NOTE: This will trigger onDrawerItemSelected without a view if you pass fireOnClick = true;
*
* @param identifier
* @param fireOnClick
*/
public boolean setSelection(int identifier, boolean fireOnClick) {
return setSelectionAtPosition(getPosition(identifier), fireOnClick);
}
代码示例来源:origin: Sparker0i/Weather
@Override
public void run() {
drawer.setSelectionAtPosition(2);
GraphsFragment graphsFragment = newGraphInstance(new ArrayList<>(wf.getDailyJson()));
getSupportFragmentManager().beginTransaction()
.replace(R.id.fragment, graphsFragment)
.commit();
}
}, 750);
代码示例来源:origin: FreedomZZQ/YouJoin-Android
/**
* method to switch the drawer content to new elements
*
* @param onDrawerItemClickListener
* @param drawerItems
* @param drawerSelection
*/
public void switchDrawerContent(@NonNull OnDrawerItemClickListener onDrawerItemClickListener, OnDrawerItemLongClickListener onDrawerItemLongClickListener, @NonNull ArrayList<IDrawerItem> drawerItems, int drawerSelection) {
//just allow a single switched drawer
if (!switchedDrawerContent()) {
//save out previous values
originalOnDrawerItemClickListener = getOnDrawerItemClickListener();
originalOnDrawerItemLongClickListener = getOnDrawerItemLongClickListener();
originalDrawerItems = getDrawerItems();
originalDrawerSelection = getCurrentSelectedPosition();
}
//set the new items
setOnDrawerItemClickListener(onDrawerItemClickListener);
setOnDrawerItemLongClickListener(onDrawerItemLongClickListener);
setItems(drawerItems, true);
setSelectionAtPosition(drawerSelection, false);
//hide stickyFooter and it's shadow
if (getStickyFooter() != null) {
getStickyFooter().setVisibility(View.GONE);
}
if (getStickyFooterShadow() != null) {
getStickyFooterShadow().setVisibility(View.GONE);
}
}
代码示例来源:origin: FreedomZZQ/YouJoin-Android
/**
* helper method to reset to the original drawerContent
*/
public void resetDrawerContent() {
if (switchedDrawerContent()) {
//set the new items
setOnDrawerItemClickListener(originalOnDrawerItemClickListener);
setOnDrawerItemLongClickListener(originalOnDrawerItemLongClickListener);
setItems(originalDrawerItems, true);
setSelectionAtPosition(originalDrawerSelection, false);
//remove the references
originalOnDrawerItemClickListener = null;
originalOnDrawerItemLongClickListener = null;
originalDrawerItems = null;
originalDrawerSelection = -1;
//if we switch back scroll back to the top
mDrawerBuilder.mRecyclerView.smoothScrollToPosition(0);
//show the stickyFooter and it's shadow again
if (getStickyFooter() != null) {
getStickyFooter().setVisibility(View.VISIBLE);
}
if (getStickyFooterShadow() != null) {
getStickyFooterShadow().setVisibility(View.VISIBLE);
}
//if we currently show the accountHeader selection list make sure to reset this attr
if (mDrawerBuilder.mAccountHeader != null && mDrawerBuilder.mAccountHeader.mAccountHeaderBuilder != null) {
mDrawerBuilder.mAccountHeader.mAccountHeaderBuilder.mSelectionListShown = false;
}
}
}
代码示例来源:origin: Clarifai/clarifai-android-starter
drawer.setSelectionAtPosition(getIntent().getIntExtra(INTENT_EXTRA_DRAWER_POSITION, 0));
内容来源于网络,如有侵权,请联系作者删除!