我需要在android中实现滑动抽屉。我正在使用jfeinstein10 / SlidingMenu库来获取我的滑动绘图组件,它基本上会打开一个列表视图。但是,单击列表菜单项,带有另一个列表的辅助菜单应向下滑动主菜单。
实例化SlidingMenu的MainActivity类
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sliding_menu_demo);
setBehindContentView(R.layout.activity_menu);
ListView listView = (ListView) findViewById(R.id.list);
getData();
ListItemAdapter listadapter = new ListItemAdapter(data, this);
listView.setAdapter(listadapter);
listView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int item,
long arg3) {
Toast.makeText(SlidingMenuDemo.this, "item clicked " + item,
Toast.LENGTH_SHORT).show();
}
});
getSlidingMenu().setBehindOffset(250);
getSlidingMenu().setFadeDegree(0.35f);
getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
}
答案 0 :(得分:1)
我使用嵌套菜单实现了它。它不是最优雅的解决方案,但到目前为止效果还不错。
此处有更多详情: How to implement two level slidingmenu in Android using jfeinstein10 / SlidingMenu?