3

我有一个带有 android SDK 18 的项目,我对 appcompat 使用支持 v4 和 v7。当我创建一个使用 android support v4 的布局时,我无法使用实用程序图形布局,如果我更改按钮位置,那么按钮就会消失。布局中的可展开列表是一个抽屉。我怎么解决这个问题?

<android.support.v4.widget.DrawerLayout  

    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    >

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent" >

        <Button
            android:id="@+id/button1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_alignParentTop="true"
            android:layout_marginRight="36dp"
            android:layout_marginTop="33dp"
            android:text="Button" />

        <Button
            android:id="@+id/button2"
            style="?android:attr/buttonStyleSmall"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_above="@+id/toggleButton1"
            android:layout_alignParentLeft="true"
            android:layout_marginBottom="29dp"
            android:layout_marginLeft="32dp"
            android:text="Button" />

        <ToggleButton
            android:id="@+id/toggleButton1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_alignParentRight="true"
            android:layout_marginBottom="67dp"
            android:layout_marginRight="18dp"
            android:text="ToggleButton" />

    </RelativeLayout>

    <ExpandableListView
        android:id="@+id/left_drawer"
        android:layout_width="240dp"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:choiceMode="singleChoice"
        android:divider="@android:color/transparent"
        android:dividerHeight="0dp"
        android:background="#2266b3"/>
        <!--android:groupIndicator="@drawable/settings_selector"-->

 </android.support.v4.widget.DrawerLayout>
4

0 回答 0