2012-01-25 9 views
0

私のアプリケーションには、水平なSlidingDrawerを含む画面が含まれています。 ユーザーが引き出しハンドルを持っている場合、引き出しは画面全体を「覆う」必要があります。それが閉じられると、「元の」画面が表示されるはずです。 FrameLayoutにドロワーを配置しましたが、ハンドルが消えました。SlidingDrawerが元の画面に移動します

どのように解決できますか?

おかげで、 エヤル

答えて

3

おかしいが、私はしないようにずっと前にこの問題を解決しました。私は少し時間がかかりましたが、いくつかのグーグルとテストの後に私はこれを考え出しました。

基本的に私は自分のレイアウト全体を "相対レイアウト"に入れて、その中に "線形レイアウト"を作成しました。 "相対レイアウト"ではなく、 "線形レイアウト"の外に私は "SlidingDrawer"を配置しました。私はボタンとハンドルを下のXMLで表示しています。また、私は "SlidingDrawer"に "Linear Layout"を作成してコンテンツを作成しました。

<?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

関連する問題