Раздвижной ящик в addHeaderView для ListView - PullRequest
1 голос
/ 27 октября 2011

Это немного сложно ... Вот что я пытаюсь сделать.

У меня есть представление списка.Я хочу добавить SlidingDrawer в этот listView с помощью addHeaderView.

Но по какой-то причине я продолжаю получать это

cannot have UNSPECIFIED dimensions

Вот XML-файлы

Это основной xml, которым я являюсьиспользуя для своей деятельности

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

</RelativeLayout>

Затем я использую следующий XML для загрузки в качестве заголовка для представления списка

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/details_header"
    android:layout_width="fill_parent"
    android:padding="7dip"
    android:layout_height="wrap_content">
    <TextView 
        android:id="@+id/listingName"
        android:layout_alignParentTop="true"
        android:textSize="20dp"
        android:textStyle="bold"
        android:padding="2dip"
        android:singleLine="true"
        android:textColor="@android:color/white"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:text="Listing Name"/>
    <TextView 
        android:id="@+id/reviewTitle"
        android:layout_alignParentRight="true"
        android:textSize="14dp"
        android:layout_below="@id/listingRating"
        android:textColor="@android:color/white"
        android:singleLine="true"
        android:textStyle="bold"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="@android:color/darker_gray"
        android:text="User Reviews:"/>
        <SlidingDrawer android:id="@+id/slidingDrawer1"
                android:layout_width="match_parent" android:layout_height="match_parent"
                android:topOffset="50dip" android:handle="@+id/handle"
                android:content="@+id/content">
                <Button android:text="Handle" android:layout_height="wrap_content"
                        android:layout_width="wrap_content" android:id="@+id/handle"></Button>
                <LinearLayout android:id="@+id/content"
                        android:layout_width="fill_parent" android:layout_height="fill_parent"
                        android:orientation="vertical" android:gravity="center"
                        android:background="#FF444444">
                        <Button android:text="Item 1" android:layout_height="wrap_content"
                                android:layout_width="wrap_content" android:id="@+id/item1"></Button>
                        <Button android:text="Item 2" android:layout_height="wrap_content"
                                android:layout_width="wrap_content" android:id="@+id/item2"></Button>
                        <Button android:text="Item 3" android:layout_height="wrap_content"
                                android:layout_width="wrap_content" android:id="@+id/item3"></Button>
                        <Button android:text="Item 4" android:layout_height="wrap_content"
                                android:layout_width="wrap_content" android:id="@+id/item4"></Button>
                        <Button android:text="Item 5" android:layout_height="wrap_content"
                                android:layout_width="wrap_content" android:id="@+id/item5"></Button>
                </LinearLayout>
        </SlidingDrawer>
</RelativeLayout>

Но как только я запускаю этот код, он выдает ошибку

10-26 18:41:05.652: E/AndroidRuntime(3734): java.lang.RuntimeException: SlidingDrawer cannot have UNSPECIFIED dimensions
10-26 18:41:05.652: E/AndroidRuntime(3734):     at android.widget.SlidingDrawer.onMeasure(SlidingDrawer.java:261)

Указатель SOme мне очень поможет .....

1 Ответ

0 голосов
/ 30 января 2012

Решение поставлено в Манифест андроида в действии:

android:windowSoftInputMode="adjustPan"
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...