Android 选择框的底部栏布局?

Android 选择框的底部栏布局?,android,android-layout,android-xml,android-menu,bottomnavigationview,Android,Android Layout,Android Xml,Android Menu,Bottomnavigationview,我正在开发一个android应用程序 我发明了这个东西 但我需要在所选菜单项后面创建一个框,如下所示 这是我需要的 我希望你能帮助我发展这个 这是我的密码 <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app=

我正在开发一个android应用程序

我发明了这个东西

但我需要在所选菜单项后面创建一个框,如下所示

这是我需要的

我希望你能帮助我发展这个

这是我的密码

    <?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/container"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="project.andromeeda.testproject.MainActivity">
<FrameLayout
    android:id="@+id/replace"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

</FrameLayout>

    <android.support.design.widget.BottomNavigationView
        android:id="@+id/navigation"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginEnd="0dp"
        android:layout_marginStart="0dp"
        android:background="#ddd"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:menu="@menu/navigation"
        app:itemBackground="@drawable/list"
        app:itemTextColor="@color/grey"/>

</android.support.constraint.ConstraintLayout>


现在,它只显示背景色,没有文本或图标。

只需添加
选择器
即可绘制到xml中的
app:itemBackground

下面是一个例子

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/red" android:state_checked="true"/>
<item android:drawable="@color/gray"/>
</selector>

Inxml

<android.support.design.widget.BottomNavigationView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:itemBackground="@drawable/item_selector"
    ></android.support.design.widget.BottomNavigationView>


根据需要修改选择器。并进行多重选择。a低于API21的标准内部可拉伸。上面是适用于API21的drawable-v21。

显示您的xml代码我试过了。但是图标是隐藏的,单击项目后只显示背景色。