2011-08-30 3 views
0

안드로이드에서 SlidingDrawer를 사용하려고 시도하고 있습니다.안드로이드 SlidingDrawer

ImageButton "handle"을 클릭하면 SlidingDrawer "slidingDrawerMP"가 "coversSongLayout"선형 레이아웃과 중첩되지만 작동하지 않습니다. 제안 사항이 있으십니까?

감사합니다

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout android:gravity="top" 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" android:layout_height="fill_parent" 
    android:orientation="vertical"> 

    <LinearLayout android:id="@+id/coversSongLayout" 
     android:layout_height="wrap_content" android:layout_width="fill_parent" 
     android:layout_weight="1"> 

     <GridView xmlns:android="http://schemas.android.com/apk/res/android" 
      android:id="@+id/coversLayout" android:layout_width="fill_parent" 
      android:layout_height="fill_parent" android:columnWidth="90dp" 
      android:numColumns="auto_fit" android:verticalSpacing="10dp" 
      android:horizontalSpacing="10dp" android:stretchMode="columnWidth" 
      android:gravity="center" android:layout_weight="1" /> 

    </LinearLayout> 

    <FrameLayout android:id="@+id/linearLayoutMP" 
     android:layout_height="28dp" android:gravity="bottom" 
     android:layout_width="fill_parent" android:background="@android:color/transparent" 
     android:layout_margin="0dip"> 

     <SlidingDrawer android:id="@+id/slidingDrawerMP" 
      android:layout_width="wrap_content" android:layout_height="wrap_content" 
      android:handle="@+id/handle" android:content="@+id/content" 
      android:background="#aa0000"> 

      <ImageButton android:id="@+id/handle" 
       android:layout_width="wrap_content" android:src="@drawable/up" 
       android:background="#fff" android:layout_height="wrap_content"></ImageButton> 

      <LinearLayout android:id="@+id/content" 
       android:background="#ccaaaaaa" android:layout_width="wrap_content" 
       android:layout_height="wrap_content"> 

       <LinearLayout android:gravity="center" 
        xmlns:android="http://schemas.android.com/apk/res/android" 
        android:layout_width="fill_parent" android:layout_height="fill_parent" 
        android:orientation="vertical" android:id="@+id/currentSongLayout"> 

        <LinearLayout android:id="@+id/coverLayout" 
         android:orientation="horizontal" android:gravity="center" 
         android:layout_height="wrap_content" android:layout_width="fill_parent"> 

         <ImageView android:id="@+id/cover" android:src="@drawable/generic_cover" 
          android:layout_width="wrap_content" android:layout_height="wrap_content" /> 
        </LinearLayout> 

        <LinearLayout android:id="@+id/songLayout" 
         android:orientation="horizontal" android:gravity="center" 
         android:layout_height="wrap_content" android:layout_width="fill_parent"> 

         <TextView android:layout_width="wrap_content" 
          android:layout_height="wrap_content" android:text="Unknowed Song" /> 
        </LinearLayout> 

        <LinearLayout android:id="@+id/artistAlbumLayout" 
         android:orientation="horizontal" android:gravity="center" 
         android:layout_height="wrap_content" android:layout_width="fill_parent"> 

         <TextView android:layout_width="wrap_content" 
          android:layout_height="wrap_content" android:text="Unknowed Artist" /> 

         <TextView android:layout_width="wrap_content" 
          android:layout_height="wrap_content" android:text=" - " /> 

         <TextView android:layout_width="wrap_content" 
          android:layout_height="wrap_content" android:text="Unknowed Album" /> 
        </LinearLayout> 
       </LinearLayout> 
      </LinearLayout> 

     </SlidingDrawer> 
    </FrameLayout> 
    <LinearLayout android:id="@+id/mediaControls" 
     android:orientation="horizontal" android:background="#ccaaaaaa" 
     android:layout_width="match_parent" android:layout_height="53dp"> 
     <ImageButton android:layout_height="wrap_content" 
      android:background="@null" android:layout_width="fill_parent" 
      android:layout_weight="1" android:src="@drawable/prev" android:id="@+id/prev"></ImageButton> 
     <ImageButton android:layout_height="wrap_content" 
      android:background="@null" android:layout_width="fill_parent" 
      android:layout_weight="1" android:src="@drawable/play" android:id="@+id/play" /> 
     <ImageButton android:layout_height="wrap_content" 
      android:background="@null" android:layout_width="fill_parent" 
      android:layout_weight="1" android:src="@drawable/next" android:id="@+id/next" /> 
    </LinearLayout> 
</LinearLayout> 

답변

2

슬라이딩 서랍을 포함하는 FrameLayout이는 서랍의 열 크기만큼 커야 만 28 DP 높다. 일반적으로 서랍의 컨테이너가 화면만큼 커야합니다.

0

선형 레이아웃에서도 서랍을 슬라이딩 할 때 문제가있었습니다. 너의 루트 레이아웃은 슬라이딩 서랍이 나머지 컨텐트 위에 놓이기위한 프레임 또는 상대 레이아웃이어야합니다. (논리적 인 것처럼 보인다). 또한 Romain이 sugested로 높이를 확인하십시오.

+0

감사합니다. 나는 "linearLayoutMP"높이를 "fill_content"로 설정했으며 SlidingDrawer 앞에 "linearLayoutMP"내부에서 "coversSongLayout"을 이동했습니다. 이제는 –

+0

도와 드리겠습니다 :) – rDroid