SlidingMenu

SlidingMenu

java:

public class MainActivity extends SlidingFragmentActivity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        addSlidingMenu();
    }

    private void addSlidingMenu() {
        setBehindContentView(R.layout.left_menu);
        SlidingMenu slidingMenu = getSlidingMenu();
        slidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);// 全屏触摸
        slidingMenu.setBehindOffset(200);// 屏幕预留200像素宽度
    }

}

 

xml(left_menu):

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#f00"
    android:orientation="vertical" >
    

</LinearLayout>

 

posted @ 2016-06-26 20:09  达哥的博客  阅读(154)  评论(0编辑  收藏  举报