4

アンドロイドの多くのものに新しい種類であり、ここに1つあります。

AndroidSlidingDrawerウィジェットで遊んでください。
画面の右側に4つ配置したいと思います。
あなたがそれらを引き出すと、それぞれが画面を埋めます。

R.layout.mainはそれらのうちの4つを作成しようとしましたが、1つしか表示されません。

私はここで間違った道を進んでいますか?

これは、2つのSlidingDrawer
が両方を右側に表示しようとして いるxmlファイルです。

<LinearLayout android:id="@+id/LinearLayout01"
              android:layout_width="fill_parent" 
              android:layout_height="wrap_content"
              xmlns:android="http://schemas.android.com/apk/res/android"
              >

 <SlidingDrawer android:id="@+id/SlidingDrawer2" 
        android:layout_width="wrap_content" 
        android:handle="@+id/slideHandleButton2" 
        android:content="@+id/contentLayout2" 
        android:layout_weight="1"
        android:layout_height="wrap_content" 
        android:orientation="horizontal">

        <Button android:id="@+id/slideHandleButton2"
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content" 
            android:topOffset="10dip"
            android:background="@drawable/icon">
        </Button>

        <RelativeLayout 
            android:layout_width="wrap_content" 
            android:id="@+id/contentLayout2" 
            android:orientation="horizontal" 
            android:gravity="center|top" 
            android:padding="10dip" 
            android:background="#C0C0C0" 
            android:layout_height="wrap_content">

       <ImageView android:id="@+id/f" 
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content" 
            android:text="Content"
            android:src="@drawable/arrow_top_right">>
        </ImageView>

    </RelativeLayout>
 </SlidingDrawer>


 <SlidingDrawer android:id="@+id/SlidingDrawer" 
        android:layout_width="wrap_content" 
        android:handle="@+id/slideHandleButton" 
        android:content="@+id/contentLayout" 
        android:orientation="horizontal"
        android:layout_weight="1"
        android:layout_height="wrap_content" 
        >

        <Button android:id="@+id/slideHandleButton"
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content" 
            android:background="@drawable/icon"
            android:topOffset="40dip">
        </Button>

        <RelativeLayout 
            android:layout_width="wrap_content" 
            android:id="@+id/contentLayout" 
            android:orientation="horizontal" 
            android:padding="10dip" 
            android:background="#C0C0C0" 
            android:layout_height="wrap_content">

         <ImageView android:id="@+id/Button03" 
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content" 
            android:text="Content"
            android:src="@drawable/arrow_top_right">
        </ImageView>
    </RelativeLayout>
 </SlidingDrawer>
</LinearLayout>
4

1 に答える 1

4

表示されているのは1つだけではないと思います。2つは重ねて表示されていると思います。両方のハンドルが見えるように、ハンドルをオフセットしてみてください。両方のスライディングドロワーに異なるオフセットでこの属性を追加してみてください。

android:topOffset="10dip"

それでも問題が解決しない場合は、これを両方のスライディングドロワーに追加してみてください。

android:layout_weight="1"
android:layout_height="0"
于 2011-06-19T20:01:34.903 に答える