android - 抽屉导航内的 RelativeLayout

标签 android android-relativelayout navigation-drawer

我正在实现 Navigation Drawer,它工作正常,但我想在 RelativeLayout 中放置一个自定义 EditText,但是一些 RelativeLayout 属性,如 layout_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"/>

我哪里错了?提前致谢

最佳答案

最后我通过在 FrameLayout 中包含另一个布局 RelativeLayout 解决了这个问题

关于android - 抽屉导航内的 RelativeLayout,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20261995/

相关文章:

Android应用重新打包: Why does it not break the code?

android - 为 URI 使用编码图像

带有可滚动页脚的 Android 抽屉导航(菜单)

android - 从 ListView 和 ArrayAdapter 中删除项目

php - 如何从 Android 应用程序连接 MySQL 数据库?

android - 无法在RelativeLayout中对齐ImageView

android - RelativeLayout 的行为与 ListView 项不同

android - RelativeLayout 在 onGlobalLayout 中更改高度并保留宽度以填充

android - 使用 Fragment Manager 和 DrawerLayout 管理多个层次结构

Android 导航 View - 项目提升