Android 底部上拉抽屉view

module链接:https://download.csdn.net/download/meixi_android/10839835

接入module方法:https://blog.csdn.net/meixi_android/article/details/84655666

 

 

1、activity实现步骤

layout文件布局——DrawerLayoutContent_ID是抽屉内容id,drawer:DrawerLayoutHandler_ID是抽屉把手id,






    



        

2、activity代码

public class MainActivity extends AppCompatActivity {

    private DrawerLayout mDrawerLayout;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.shanghua);

        mDrawerLayout = (DrawerLayout) findViewById(R.id.dial_drawer);
        mDrawerLayout.setInitialState(DrawerLayout.State.Close); //set drawer initial state: open or close
        mDrawerLayout.setDrawerListener(new DrawerLayout.DrawerListener()
        {
            @Override
            public void drawerOpened()
            {

            }

            @Override
            public void drawerClosed()
            {

            }
        });
    }
}

关闭抽屉效果

Android 底部上拉抽屉view_第1张图片

打开抽屉效果

Android 底部上拉抽屉view_第2张图片

你可能感兴趣的:(移动开发)