我正在使用jfeinstein10库和示例项目。我想在左侧滑动菜单中显示一些菜单选项,在右侧滑动菜单中显示其他一些选项菜单。但我无法做到这一点。这是代码: package com.slidingmenu.example;
public class LeftAndRightActivity extends BaseActivity {
public LeftAndRightActivity() {
super(R.string.left_and_right);
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getSlidingMenu().setMode(SlidingMenu.LEFT_RIGHT);
getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
setContentView(R.layout.content_frame);
getSupportFragmentManager()
.beginTransaction()
.replace(R.id.content_frame, new SampleFragment())
.commit();
getSlidingMenu().setSecondaryMenu(R.layout.menu_frame_two);
getSlidingMenu().setSecondaryShadowDrawable(R.drawable.shadowright);
getSupportFragmentManager()
.beginTransaction()
.replace(R.id.menu_frame_two, new SampleFragment())
.commit();
}
}
这是我在onCreate中设置的内容:
getSlidingMenu().setMode(SlidingMenu.LEFT_RIGHT);
getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
setContentView(R.layout.content_frame);
getSupportFragmentManager()
.beginTransaction()
.replace(R.id.content_frame, new SampleListFragment())
.commit();
getSlidingMenu().setMenu(R.layout.menu_frame_two);
getSlidingMenu().setShadowDrawable(R.drawable.shadowright);
getSupportFragmentManager()
.beginTransaction()
.replace(R.id.menu_frame_two, new SampleListFragment2())
.commit();
getSlidingMenu().setSecondaryMenu(R.layout.menu_frame_two);
getSlidingMenu().setSecondaryShadowDrawable(R.drawable.shadowright);
getSupportFragmentManager()
.beginTransaction()
.replace(R.id.menu_frame_two, new SampleListFragment2())
.commit();
每当我使用这个程序时,我的程序都会崩溃。这里是我的logcat:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.slidingmenu.example/com.slidingmenu.example.LeftAndRightActivity}: java.lang.IllegalArgumentException: No view found for id 0x7f05003c for fragment Fragment{41260b30 #0 id=0x7f05003c}