Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/213.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在Android API 10级上实现一个内置ListView的滑动抽屉?_Android_Listview_User Interface_Android Listview_Slidingdrawer - Fatal编程技术网

如何在Android API 10级上实现一个内置ListView的滑动抽屉?

如何在Android API 10级上实现一个内置ListView的滑动抽屉?,android,listview,user-interface,android-listview,slidingdrawer,Android,Listview,User Interface,Android Listview,Slidingdrawer,我已经在安卓上玩了一段时间了,我已经使用安卓支持库v4中的DrawerLayout构建了用户界面 我的大学老师强迫我们使用API Level 10为这门学科构建应用程序,所以我就是这么做的 我试图建立一个滑动抽屉,里面有一个列表视图,但我找不到正确的方法来做它。以下代码导致两个错误 <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/ap

我已经在安卓上玩了一段时间了,我已经使用安卓支持库v4中的
DrawerLayout
构建了用户界面

我的大学老师强迫我们使用API Level 10为这门学科构建应用程序,所以我就是这么做的

我试图建立一个滑动抽屉,里面有一个列表视图,但我找不到正确的方法来做它。以下代码导致两个错误

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/details"
android:layout_width="fill_parent"
android:layout_height="wrap_content">

    <SlidingDrawer
          android:id="@+id/slidingDrawerShowMore"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:topOffset="132dip"
          android:handle="@+id/handle"
          android:content="@+id/handle">

        <ImageView
         android:id="@id/handle"             
         android:layout_width="88dip"
         android:layout_height="44dip" />
    </SlidingDrawer>

(在我将抽屉的内容值更改为@+id/content后引发此问题)

这是我期待的结果

有没有办法解决这个问题


我在API 17上完美地运行了这个UI,在DrawerLayout上的ListView上有一个自定义ListAdapter(来自android.support.v4.widget.DrawerLayout),但它在较低的API级别上不起作用。

您使用的是NavigationDrawer,它在android中使用组件。这只适用于3.0及以上版本。因此,你需要删除应用程序中的ActionBar代码,并尝试使用自己的标题代码

否则,更改actionbar的代码,这是一个用于在较低版本中处理actionbar的库,只需遵循url即可轻松实现

Exception raised during rendering: com.android.layoutlib.bridge.MockView cannot be cast to android.view.ViewGroup
Exception raised during rendering: The content attribute is must refer to an existing child.