BottomNavigationBar图标未显示

时间:2018-10-13 19:04:28

标签: android bottomnavigationview

我刚刚创建了底部导航栏,并将其与底部对齐。我不知道这是什么问题,我在运行程序时看不到图标。 MainActivity.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/TextcolorforWhite"
tools:context=".activities.MainMenuActivity">

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

    <android.support.v7.widget.RecyclerView
        android:id="@+id/menu_recyclerView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingBottom="50dp"/>
</ScrollView>

<com.ittianyu.bottomnavigationviewex.BottomNavigationViewEx
    android:id="@+id/nav_menu"
    android:layout_width="match_parent"
    android:layout_height="56dp"
    android:layout_alignParentBottom="true"
    android:background="@drawable/red_border_nav_top"
    app:menu="@menu/user_nav_menu" />

image

user_nav_menu.xml

<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">

<item
    android:id="@+id/nav_Menu"
    android:enabled="true"
    android:icon="@drawable/menu"
    android:title="@string/menu"
    app:showAsAction="ifRoom"/>
<item
    android:id="@+id/nav_Deals"
    android:enabled="true"
    android:icon="@drawable/deals"
    android:title="@string/deals"
    app:showAsAction="ifRoom"/>
<item
    android:id="@+id/nav_TrackOrder"
    android:enabled="true"
    android:icon="@drawable/track"
    android:title="@string/track"
    app:showAsAction="ifRoom"/>
<item
    android:id="@+id/nav_Settings"
    android:enabled="true"
    android:icon="@drawable/settings"
    android:title="@string/settings"
    app:showAsAction="ifRoom"/></menu>

Red_border_nav_top

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="1dp">
<item
    android:bottom="-2dp"
    android:top="1dp"
    android:right="-2dp"
    android:left="-2dp">
    <shape android:shape="rectangle">
        <stroke android:width="1dp"
            android:color="@color/colorPrimaryDark"/>
        <solid android:color="@color/TextcolorforWhite"/>
    </shape>
</item>

我在互联网上的每个地方进行搜索,以找到解决方案,但没有任何帮助。

0 个答案:

没有答案