标签:
* 侧边栏 */
public class SlidingActivity extends AppCompatActivity {
private View view;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sliding);
SlidingMenu slidingMenu=new SlidingMenu(this);//new一个侧边栏
slidingMenu.setMode(slidingMenu.LEFT);//左滑or右滑
view=getLayoutInflater().inflate(R.layout.activity_lianxi,null); //slidingMenu.setMenu(view);//从左测滑出侧边栏布局
slidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);//设置屏幕滑动范围,// 屏幕任意滑动
slidingMenu.setSecondaryMenu(view);//设置右侧滑出布局
slidingMenu.setBehindWidth(300);//侧边栏宽度
//slidingMenu.setBehindOffset(380); 剩余部分宽度
slidingMenu.setFadeDegree(0.35f);//滑动速度??
slidingMenu.attachToActivity(this,SlidingMenu.SLIDING_CONTENT);
}
}
标签:
原文地址:http://www.cnblogs.com/leirenyuan/p/5730968.html