我需要在 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);
}