Java Android slidemenu在内容上绘制
我正在使用这个幻灯片菜单java类,但我不知道如何在活动内容上绘制幻灯片菜单这是我的布局代码:Java Android slidemenu在内容上绘制,java,android,android-layout,Java,Android,Android Layout,我正在使用这个幻灯片菜单java类,但我不知道如何在活动内容上绘制幻灯片菜单这是我的布局代码: <?xml version="1.0" encoding="utf-8"?> <com.agimind.widget.SlideHolder xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:id="@+i
<?xml version="1.0" encoding="utf-8"?>
<com.agimind.widget.SlideHolder
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:id="@+id/smenu"
android:layout_height="match_parent"
>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="140dp"
android:layout_height="match_parent"
>
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:background="@color/mainBg"
android:weightSum="12"
android:layout_height="match_parent">
</LinearLayout>
</com.agimind.widget.SlideHolder>
这是类似于这张照片的结果:
但我需要做像这样的事情:
有机会这样做吗?只需使用android.support.v4.widget.DrawerLayout:
<android.support.v4.widget.DrawerLayout
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<RelativeLayout
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
<ListView
android:id="@+id/left_wraper"
android:layout_width="320dp"
android:layout_height="fill_parent"
android:layout_gravity="left"
android:background="#DDFAFAFA"
android:choiceMode="singleChoice"
android:divider="@android:color/transparent"
android:dividerHeight="0dp"
/>
</android.support.v4.widget.DrawerLayout>
作为Android设计指南的一部分,有一种叫做导航抽屉的东西可以很好地解决你的问题:我需要用那个幻灯片创建它,我确实知道有一个导航抽屉存在。。。
mDrawer = (DrawerLayout) findViewById(R.id.drawer);
mDrawerList = (ListView) findViewById(R.id.left_wrapper);
String[] names = { "Create", "Show up", "Hide out", "WebView", "Registration", "LogIn View" };
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, names);
mDrawerList.setAdapter(adapter);
mDrawerList.setOnItemClickListener(new DrawerItemClickListener());
private class DrawerItemClickListener implements ListView.OnItemClickListener {
@Override
public void onItemClick(AdapterView parent, View view, int position, long id) {
switch (position) {
case 0: break;
case 1: break;
}
}