简体   繁体   English

单击按钮后如何更改内容SideDrawer

[英]how to change content SideDrawer after click on button

I am using this lib for my project. 我正在为我的项目使用这个库。

https://github.com/adamrocker/simple-side-drawer https://github.com/adamrocker/simple-side-drawer

I would like to change current layout of SideDrawer to another layout. 我想将SideDrawer的当前布局更改为另一种布局。

is it possible ? 可能吗 ?

在此处输入图片说明

there are many applications that use this approach. 有许多应用程序都使用这种方法。 like : 喜欢 :

https://play.google.com/store/apps/details?id=com.zalora.android&hl=en https://play.google.com/store/apps/details?id=com.zalora.android&hl=zh_CN

在此处输入图片说明

在此处输入图片说明

is there an example ? 有例子吗?

I checked the code provided in the github repository you've referenced. 我检查了您引用的github存储库中提供的代码。 I found this : 我找到了这个 :

mNav = new SimpleSideDrawer(this);

mNav.setLeftBehindContentView(R.layout.activity_behind_left_simple);
findViewById(R.id.leftBtn).setOnClickListener(new OnClickListener() {
    @Override
    public void onClick(View v) {
        mNav.toggleLeftDrawer();
    }
});

mNav.setRightBehindContentView(R.layout.activity_behind_right_simple);
    findViewById(R.id.rightBtn).setOnClickListener(new OnClickListener() {
    @Override
    public void onClick(View v) {
        mNav.toggleRightDrawer();
    }
});

So maybe you cuold have a listner on your button in the leftBehindContent which will perform action like : 因此,也许您认为在leftBehindContent的按钮上有一个列表器,它将执行以下操作:

mNav.setRightBehindContentView(R.layout.new_layout)

new_layout.xml must be present in your android layout folder ;) ! new_layout.xml必须存在于您的android布局文件夹中;)!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM