2012-01-25 2 views
0

내 응용 프로그램에 수평 슬라이딩 드로우가 포함 된 화면이 있습니다. 사용자가 서랍 핸들을 사용하면 서랍은 전체 화면을 "덮어야"합니다. 닫을 때 "원래"화면이 나타납니다. FrameLayout에 서랍을 배치했지만 핸들이 사라졌습니다.SlidingDrawer가 원래 화면 위로 이동합니다.

어떻게 해결 될 수 있습니까?

감사합니다, Eyal 님

답변

3

재미, 난 그냥에 오래 전에이 문제를 해결했다. 조금 시간이 걸렸지 만 일부 검색 및 테스트를 마친 후에는 다음과 같이 생각해 냈습니다.

기본적으로 전체 레이아웃을 "상대 레이아웃"에 넣은 다음 기본 레이아웃의 "선형 레이아웃"을 작성했습니다. "Relative Layout"에는 있지만 "Linear Layout"외부에는 "SlidingDrawer"를 넣습니다. 나는 아래의 xml에 버튼과 핸들을 보여주고있다. 또한, "SlidingDrawer"에 "선형 레이아웃"을 만들어 컨텐트를 만들었습니다.

<?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" 
android:orientation="vertical" > 
<LinearLayout 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:orientation="vertical" > 

..stuff for the main screen 

</LinearLayout> 
<SlidingDrawer 
    android:id="@+id/SlidingDrawer" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:content="@+id/contentLayout" 
    android:handle="@+id/slideHandleButton" > 
    <Button 
     android:id="@+id/slideHandleButton" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_gravity="center" 
     android:background="@drawable/list_background" 
     android:padding="8dp" 
     android:text="My App" 
     android:textSize="7pt" > 
    </Button> 
    <LinearLayout> 

     ...sliding drawing is at the bottom 
    ...stuff in here will be in the sliding drawer 

    </LinearLayout> 
</SlidingDrawer> 
</RelativeLayout> 

게시하기 전에이 코드로 테스트 응용 프로그램을 실행 했으므로 작동합니다. 궁금한 점이 있으면 부탁드립니다. 도움이되기를 바랍니다.

enter image description here

관련 문제