导航抽屉内的RelativeLayout

时间:2013-11-28 09:18:18

标签: android relativelayout navigation-drawer

我正在实施Navigation Drawer,它运作正常,但我想在RelativeLayout中定位自定义EditText,但是RelativeLayoutlayout_centerInParent属性丢失,我可以'将它们分配给我的自定义EditText:

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

<FrameLayout
    android:id="@+id/search_frame"
    android:layout_width="match_parent"
    android:layout_height="match_parent" 
    android:background="@string/activity_search_color">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:background="@string/bg_color" >

        <com.xxx.xxx.Buttons.CustomEditText 
            xmlns:custom="http://schemas.android.com/apk/res/com.xxx.xxx"
            android:id="@+id/edt_box"
            android:gravity="center|center_vertical"
            custom:typeface="bold"
            style="@style/edtstyle"
        />


    </RelativeLayout>

</FrameLayout>

<ListView android:id="@+id/left_drawer"
    android:layout_width="@dimen/nav_width"
    android:layout_height="match_parent"
    android:layout_gravity="right"
    android:choiceMode="singleChoice"
    android:divider="@android:color/black"
    android:dividerHeight="0.0dp"
    android:listSelector="@drawable/selector_nav"
    android:drawSelectorOnTop="true"/>

我的错误在哪里?在此先感谢

1 个答案:

答案 0 :(得分:1)

最后,我解决了在FrameLayout

中包含另一个布局,即RelativeLayout的问题