安卓系统中的很多东西都是新事物,这里有一个。
使用android slidingdrawer小部件到处玩。
我真的很想在屏幕的右边有四个。
每一个都填满了屏幕。
我尝试在我的R.layout.main
中创建4个,但只有一个出现。
我走错路了吗?
这是带有两个滑动抽屉的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>
最佳答案
我不认为它只是一个展示。我想这两个是一个在另一个上面显示的。尝试偏移控制柄,以便可以看到两个控制柄。尝试将具有不同偏移的此属性添加到两个滑动抽屉:
android:topOffset="10dip"
如果不起作用,请尝试将其添加到两个滑动抽屉:
android:layout_weight="1"
android:layout_height="0"