本文整理汇总了Java中android.support.v4.widget.SlidingPaneLayout类的典型用法代码示例。如果您正苦于以下问题:Java SlidingPaneLayout类的具体用法?Java SlidingPaneLayout怎么用?Java SlidingPaneLayout使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SlidingPaneLayout类属于android.support.v4.widget包,在下文中一共展示了SlidingPaneLayout类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreateView
import android.support.v4.widget.SlidingPaneLayout; //导入依赖的package包/类
@Override
protected void onCreateView(final Bundle savedInstanceState) {
setContentView(R.layout.activity_feature_uart);
// Setup the sliding pane if it exists
final SlidingPaneLayout slidingPane = mSlider = (SlidingPaneLayout) findViewById(R.id.sliding_pane);
if (slidingPane != null) {
slidingPane.setSliderFadeColor(Color.TRANSPARENT);
slidingPane.setShadowResourceLeft(R.drawable.shadow_r);
slidingPane.setPanelSlideListener(new SlidingPaneLayout.SimplePanelSlideListener() {
@Override
public void onPanelClosed(final View panel) {
// Close the keyboard
final UARTLogFragment logFragment = (UARTLogFragment) getSupportFragmentManager().findFragmentById(R.id.fragment_log);
logFragment.onFragmentHidden();
}
});
}
}
示例2: configureFullDrawer
import android.support.v4.widget.SlidingPaneLayout; //导入依赖的package包/类
private void configureFullDrawer() {
if (getDrawerLayout() != null) {
ActionBarDrawerToggle drawerToggle = new ActionBarDrawerToggle(
this, getDrawerLayout(), getContentBinding().toolbar, 0, 0);
getDrawerLayout().addDrawerListener(drawerToggle);
getDrawerLayout().setDrawerLockMode(
DrawerLayout.LOCK_MODE_UNLOCKED,
Gravity.START);
drawerToggle.syncState();
} else {
final ViewGroup.LayoutParams params = getContentBinding().drawerLayout.getLayoutParams();
if (!(params instanceof SlidingPaneLayout.LayoutParams)) {
getContentBinding().drawerLayout.setDrawerLockMode(
DrawerLayout.LOCK_MODE_LOCKED_CLOSED,
Gravity.START);
}
if (mModel.hasForceSinglePanel) {
// Someones is requesting a single panel in a multipanel layout
// Just hide the multipanel
mModel.hasMiniDrawer = false;
}
}
}
示例3: onCreate
import android.support.v4.widget.SlidingPaneLayout; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.about_us);
findViewById(R.id.back_btn).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AboutUs.this.finish();
overridePendingTransition(R.anim.nude, R.anim.slide_out_to_right);
}
});
((TextView) findViewById(R.id.action_bar_title)).setText(getString(R.string.about_us));
developersTeam = (new DBHelper(this)).getUserInfoes(false);
managementTeam = (new DBHelper(this)).getUserInfoes(true);
pane = (SlidingPaneLayout) findViewById(R.id.sp);
InfoFragment f = (InfoFragment) getSupportFragmentManager().findFragmentById(R.id.leftpane);
f.selectMember(developersTeam.get(0));
if (!pane.isSlideable()) {
getSupportFragmentManager().findFragmentById(R.id.leftpane).setHasOptionsMenu(false);
getSupportFragmentManager().findFragmentById(R.id.rightpane).setHasOptionsMenu(true);
}
}
示例4: onCreateView
import android.support.v4.widget.SlidingPaneLayout; //导入依赖的package包/类
@Override
protected void onCreateView(final Bundle savedInstanceState) {
setContentView(R.layout.activity_feature_uart);
mContainer = findViewById(R.id.container);
// Setup the sliding pane if it exists
final SlidingPaneLayout slidingPane = mSlider = findViewById(R.id.sliding_pane);
if (slidingPane != null) {
slidingPane.setSliderFadeColor(Color.TRANSPARENT);
slidingPane.setShadowResourceLeft(R.drawable.shadow_r);
slidingPane.setPanelSlideListener(new SlidingPaneLayout.SimplePanelSlideListener() {
@Override
public void onPanelClosed(final View panel) {
// Close the keyboard
final UARTLogFragment logFragment = (UARTLogFragment) getSupportFragmentManager().findFragmentById(R.id.fragment_log);
logFragment.onFragmentHidden();
}
});
}
}
示例5: onCreate
import android.support.v4.widget.SlidingPaneLayout; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
mNavigationDrawerFragment = (NavigationDrawerFragment)
getSupportFragmentManager().findFragmentById(R.id.navigation_drawer);
// Set up the drawer.
View parentView = findViewById(R.id.drawer_layout);
if(parentView instanceof DrawerLayout) {
mNavigationDrawerFragment.setUp(
R.id.navigation_drawer,
(DrawerLayout) parentView, toolbar);
} else {
mNavigationDrawerFragment.setUpForTablets(
R.id.navigation_drawer,
(SlidingPaneLayout) parentView);
}
}
示例6: onCreateView
import android.support.v4.widget.SlidingPaneLayout; //导入依赖的package包/类
@Override
protected void onCreateView(final Bundle savedInstanceState) {
setContentView(R.layout.activity_feature_uart);
// Setup the sliding pane if it exists
final SlidingPaneLayout slidingPane = mSlider = (SlidingPaneLayout) findViewById(R.id.sliding_pane);
if (slidingPane != null) {
slidingPane.setSliderFadeColor(Color.TRANSPARENT);
slidingPane.setShadowResourceLeft(R.drawable.shadow_r);
slidingPane.setPanelSlideListener(new SlidingPaneLayout.SimplePanelSlideListener() {
@Override
public void onPanelClosed(final View panel) {
// Close the keyboard
final UARTLogFragment logFragment = (UARTLogFragment) getFragmentManager().findFragmentById(R.id.fragment_log);
logFragment.onFragmentHidden();
}
});
}
}
示例7: onCreate
import android.support.v4.widget.SlidingPaneLayout; //导入依赖的package包/类
@Override protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
slidingPaneLayout = new SlidingPaneLayout(this);
slidingPaneLayout.setId(android.R.id.primary);
FrameLayout paneOne = new FrameLayout(this);
LayoutParams paneOneParams = new LayoutParams(300, MATCH_PARENT);
slidingPaneLayout.addView(paneOne, paneOneParams);
FrameLayout paneTwo = new FrameLayout(this);
paneTwo.setBackgroundColor(Color.WHITE);
LayoutParams paneTwoParams = new LayoutParams(MATCH_PARENT, MATCH_PARENT);
paneTwoParams.leftMargin = 50;
slidingPaneLayout.addView(paneTwo, paneTwoParams);
setContentView(slidingPaneLayout);
}
示例8: onCreate
import android.support.v4.widget.SlidingPaneLayout; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.sliding_pane_layout);
mSlidingLayout = (SlidingPaneLayout) findViewById(R.id.sliding_pane_layout);
mList = (ListView) findViewById(R.id.left_pane);
mContent = (TextView) findViewById(R.id.content_text);
mSlidingLayout.setPanelSlideListener(new SliderListener());
mSlidingLayout.openPane();
mList.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1,
Shakespeare.TITLES));
mList.setOnItemClickListener(new ListItemClickListener());
mActionBar = createActionBarHelper();
mActionBar.init();
mSlidingLayout.getViewTreeObserver().addOnGlobalLayoutListener(new FirstLayoutListener());
}
示例9: handleViewConversationIntent
import android.support.v4.widget.SlidingPaneLayout; //导入依赖的package包/类
private void handleViewConversationIntent(Intent intent) {
String uuid = (String) intent.getExtras().get(CONVERSATION);
String text = intent.getExtras().getString(TEXT, "");
String nick = intent.getExtras().getString(NICK,null);
selectConversationByUuid(uuid);
this.mConversationFragment.reInit(getSelectedConversation());
if (nick!=null) {
this.mConversationFragment.highlightInConference(nick);
} else {
this.mConversationFragment.appendText(text);
}
hideConversationsOverview();
openConversation();
if (mContentView instanceof SlidingPaneLayout) {
updateActionBarTitle(true); //fixes bug where slp isn't properly closed yet
}
}
示例10: setPortraitMode
import android.support.v4.widget.SlidingPaneLayout; //导入依赖的package包/类
private void setPortraitMode()
{
SlidingPaneLayout.LayoutParams params = (SlidingPaneLayout.LayoutParams) rightContainer.getLayoutParams();
params.width = KlyphDevice.getDeviceWidth();// rightContainerWidth;
// params.leftMargin = paddingLeft;
params.rightMargin = 0;
rightContainer.setLayoutParams(params);
params = (SlidingPaneLayout.LayoutParams) leftContainer.getLayoutParams();
params.width = leftContainerWidth;
params.leftMargin = 0;
params.rightMargin = 0;
leftContainer.setLayoutParams(params);
slidingPane.requestLayout();
}
示例11: initSwipeBackFinish
import android.support.v4.widget.SlidingPaneLayout; //导入依赖的package包/类
private void initSwipeBackFinish(){
if (isSupportSwipeBack()) {
PagerEnabledSlidingPaneLayout slidingPaneLayout = new PagerEnabledSlidingPaneLayout(this);
//通过反射改变mOverhangSize的值为0,这个mOverhangSize值为菜单到右边屏幕的最短距离,默认
//是32dp,现在给它改成0
try {
//属性
Field f_overHang = SlidingPaneLayout.class.getDeclaredField("mOverhangSize");
f_overHang.setAccessible(true);
f_overHang.set(slidingPaneLayout, 0);
} catch (Exception e) {
e.printStackTrace();
}
slidingPaneLayout.setPanelSlideListener(this);
slidingPaneLayout.setSliderFadeColor(Color.TRANSPARENT);
View leftView = new View(this);
leftView.setLayoutParams(new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
slidingPaneLayout.addView(leftView, 0);
ViewGroup decor = (ViewGroup) getWindow().getDecorView();
ViewGroup decorChild = (ViewGroup) decor.getChildAt(0);
decorChild.setBackgroundColor(Color.WHITE);
decor.removeView(decorChild);
decor.addView(slidingPaneLayout);
slidingPaneLayout.addView(decorChild, 1);
}
}
示例12: onInitializeAccessibilityNodeInfo
import android.support.v4.widget.SlidingPaneLayout; //导入依赖的package包/类
@Override
public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfoCompat info) {
final AccessibilityNodeInfoCompat superNode = AccessibilityNodeInfoCompat.obtain(info);
super.onInitializeAccessibilityNodeInfo(host, superNode);
copyNodeInfoNoChildren(info, superNode);
superNode.recycle();
info.setClassName(SlidingPaneLayout.class.getName());
info.setSource(host);
final ViewParent parent = ViewCompat.getParentForAccessibility(host);
if (parent instanceof View) {
info.setParent((View) parent);
}
// This is a best-approximation of addChildrenForAccessibility()
// that accounts for filtering.
final int childCount = getChildCount();
for (int i = 0; i < childCount; i++) {
final View child = getChildAt(i);
if (!filter(child) && (child.getVisibility() == View.VISIBLE)) {
// Force importance to "yes" since we can't read the value.
ViewCompat.setImportantForAccessibility(
child, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES);
info.addChild(child);
}
}
}
示例13: initSwipeBackFinish
import android.support.v4.widget.SlidingPaneLayout; //导入依赖的package包/类
/**
* 初始化滑动返回
*/
private void initSwipeBackFinish() {
if (isSupportSwipeBack) {
SlidingPaneLayout slidingPaneLayout = new SlidingPaneLayout(this);
//通过反射改变mOverhangSize的值为0,这个mOverhangSize值为菜单到右边屏幕的最短距离,默认
//是32dp,现在给它改成0
try {
//属性
Field f_overHang = SlidingPaneLayout.class.getDeclaredField("mOverhangSize");
f_overHang.setAccessible(true);
f_overHang.set(slidingPaneLayout, 0);
} catch (Exception e) {
e.printStackTrace();
}
slidingPaneLayout.setPanelSlideListener(BaseActivityWithSlidingPaneLayout.this);
slidingPaneLayout.setSliderFadeColor(getResources().getColor(android.R.color.transparent));
//slidingPaneLayout.setLayoutParams(new SlidingPaneLayout.LayoutParams(100,SlidingPaneLayout.LayoutParams.MATCH_PARENT));
View leftView = new View(this);
leftView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
slidingPaneLayout.addView(leftView, 0);
ViewGroup decor = (ViewGroup) getWindow().getDecorView();
ViewGroup decorChild = (ViewGroup) decor.getChildAt(0);
//decorChild.setBackgroundColor(getResources().getColor(android.R.color.white));
decor.removeView(decorChild);
decor.addView(slidingPaneLayout);
slidingPaneLayout.addView(decorChild, 1);
}
}
示例14: showConversationsOverview
import android.support.v4.widget.SlidingPaneLayout; //导入依赖的package包/类
public void showConversationsOverview() {
if (mContentView instanceof SlidingPaneLayout) {
SlidingPaneLayout mSlidingPaneLayout = (SlidingPaneLayout) mContentView;
mShouldPanelBeOpen.set(true);
mSlidingPaneLayout.openPane();
}
}
示例15: hideConversationsOverview
import android.support.v4.widget.SlidingPaneLayout; //导入依赖的package包/类
public void hideConversationsOverview() {
if (mContentView instanceof SlidingPaneLayout) {
SlidingPaneLayout mSlidingPaneLayout = (SlidingPaneLayout) mContentView;
mShouldPanelBeOpen.set(false);
mSlidingPaneLayout.closePane();
}
}