标签:android http io ar os sp on art cti
1、DrawerLayout 谷歌官方提供
(1) https://developer.android.com/training/implementing-navigation/nav-drawer.html
下载它的demo,导入运行。
(2)Support v4 Demos---->Widget----->Drawer layout
(3)实现手势滑动:
FrameLayout content_frame=(FrameLayout)findViewById(R.id.content_frame);
content_frame.setOnTouchListener(new OnTouchListener() {
float startX ;
@Override
public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
startX = event.getX();
break;
case MotionEvent.ACTION_UP:
if (event.getX() > startX) { // 向右滑动
/*if (!mDrawerLayout.isDrawerVisible(GravityCompat.START)) {
}*/
mDrawerLayout.openDrawer(GravityCompat.START);
mDrawerLayout.setDrawerListener(mDrawerToggle);
} else if (event.getX() < startX) { // 向左滑动
mDrawerLayout.closeDrawer(GravityCompat.START);
}
break;
}
return true;
}
});
标签:android http io ar os sp on art cti
原文地址:http://my.oschina.net/u/1389206/blog/345859