[英]How to toggle on both sides in feinstein's SlidingMenu (Left_Right mode) using icons in ActionBar?
I am using feinstein's SlidingMenuActivity. 我正在使用feinstein的SlidingMenuActivity。 I had set the mode in LEFT_RIGHT and I would like my application to have two icons in the action bar where they automatically will toggle the view between left layout - central layout and central layout - right layout respectively. 我已经在LEFT_RIGHT中设置了模式,我希望我的应用程序在操作栏中有两个图标,它们会自动在左布局-中央布局和中央布局-右布局之间切换视图。 The first toggle is easy using home icon. 使用主页图标可以轻松进行第一个切换。 However I cannot find a way doing that for the right side. 但是我找不到正确的方法。 Here is the code: 这是代码:
public class MainActivity extends Activity {
.
.
.
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
menu.toggle();
return true;
case R.id.second_icon:
// do toggle between central and right layout
return true;
}
return super.onOptionsItemSelected(item);
}
}
I have to deal with two problems: 我必须处理两个问题:
First of all the second icon does not respond (it doesn't get inside case R.id.second_button). 首先,第二个图标不响应(它不在R.id.second_button的内部)。
toggle() changes the view between left and central layout in Left_Right Mode. toggle()在Left_Right模式下在左侧和中央布局之间更改视图。 Is there any way to do that between central and right layout? 有没有办法在中央布局和正确布局之间做到这一点?
try showSecondaryMenu()
尝试showSecondaryMenu()
cheers :) 欢呼:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.