0

私はこの問題を 2 日間抱えていますが、解決策が見つかりません。

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/RelativeLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >

<ListView
    android:id="@+id/presentation_list"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >
</ListView>

<SlidingDrawer
    android:id="@+id/slidingDrawer1"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_below="@id/presentation_list"
    android:content="@+id/content"
    android:handle="@+id/handle"
    android:orientation="horizontal" >

    <Button
        android:id="@+id/handle"
        android:layout_width="40dp"
        android:layout_height="fill_parent"
        android:background="@android:color/darker_gray" />

    <LinearLayout
        android:id="@+id/content"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical" >

        <ImageView
            android:id="@+id/content_imageview"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@android:color/black" />
    </LinearLayout>
</SlidingDrawer>

私はこの非常に単純なレイアウトを持ってlistviewおり、slidingdrawerと を乗り越えたいと思っていlistviewます。情報なしで開くactivityと、例外なく完璧に表示されます。

しかし、 my にアイテムがある場合listview、 myslidingdrawerはその種の例外を与えます。

   AndroidRuntime(4722): java.lang.RuntimeException: SlidingDrawer cannot have UNSPECIFIED dimensions

私はこれを解決策として何度も検索しましたが、どれもうまくいきません。

私にとって素晴らしいブレークスルーを持っている人はいますか?とても感謝しています!

4

3 に答える 3

0

これについてちょっと考えてみてください....スライドドロワー内の content_imageview の正確な寸法を定義するとどうなりますか。

コードと Android ドキュメントhttp://developer.android.com/reference/android/widget/SlidingDrawer.htmlを表示すると、これが唯一の違いのように見えます。

http://developer.android.com/reference/android/view/View.htmlを読んで理解UNSPECIFIEDを深め、それが MeasureSpec でどのように使用されているかを理解する価値があるかもしれません。

ハンドル コンポーネントのセット ディメンションの指定も参照してください。

定義したレイアウトに関しては、スライディング ドロワーを alignParentBottom に指定し、リスト ビューをスライディング ドロワーの上に配置することをお勧めします。短いリストでは、スライド式引き出しはレイアウトの半分に収まります...

于 2012-08-09T11:18:08.457 に答える
-1

SlidingDrawerその逆ではなく、内部で定義する必要があると思いますLinearLayout

于 2012-08-09T10:10:33.770 に答える