2012-08-09 3 views
0

이 문제는 2 일 동안 발생하며 해결책을 찾을 수 없습니다. listview 및 slidingdrawer가 오류를 발생시킵니다.

<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와 나는 listview을 와서하고 싶은 slidingdrawer이 매우 간단한 레이아웃을 가지고있다. 내 activity 정보없이 열면 모든 종류의 예외없이 완벽하게 나타납니다.

그러나 내 listview에 항목이있는 경우 내 slidingdrawer은 예외입니다.

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

나는 여러 번이 솔루션을 찾고 있지만 NONE은 나를 찾는다.

나를 위해 훌륭한 돌파구를 가진 사람이 있습니까? 대단히 감사합니다!

+0

내 레이아웃이 작동하며 레이아웃과 일치하도록 내 질문이 업데이트되었습니다. – Robin

답변

-1

SlidingDrawer 내부에 LinearLayout을 정의해야한다고 생각합니다.

+0

아니야, 그 linearlayout 내 slidingdrawer 내용을 나타냅니다. – Robin

0

여기에 대해 생각해보십시오. 슬라이딩 서랍 안에있는 content_imageview의 정확한 크기를 정의하면 어떻게됩니까?

코드와 Android 설명서 http://developer.android.com/reference/android/widget/SlidingDrawer.html을 볼 때 이것은 유일한 차이점 인 것처럼 보입니다.

UNSPECIFIED을 더 잘 이해하고 MeasureSpec에서 어떻게 사용되는지 이해하려면 http://developer.android.com/reference/android/view/View.html을 읽을 가치가 있습니다.

핸들 구성 요소에 대한 치수를 지정하십시오.

정의한 레이아웃과 관련하여 슬라이딩 드로어를 alignParentBottom으로 지정하고 슬라이딩 드로어 위의 목록 뷰를 정렬하는 것이 좋습니다. 짧은 목록에서 슬라이딩 서랍은 레이아웃의 절반에 위치하게됩니다 ...

0

android:layout_height에 상대 레이아웃 번호 (예 : 600 딥)를 지정하십시오. 슬라이딩 서랍 레이아웃 높이가 match_parent 인 경우 레이아웃 높이가 fill_parent 인 상대 레이아웃을 따라 가며 슬라이딩 서랍을 무한대로 만듭니다.