1 year ago
#371959
Taylor G
BottomNavigationView not showing icons
I've checked all the other posts I can find on this and can't get the icons to even show in the Design preview but it is showing the navigation bar block in design view (with no text or icons).
I am using a nested linear layout and I have set the icons to appear as white against a darker background tint, but when I set up the action bar and tab icon type, i chose the HOLO_DARK theme so they should have been white anyway (I added the icon tint as white too, just to see if that made a difference).
Here is my xml code for the activity:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".LoginActivity">
<TextView
android:layout_width="match_parent"
android:layout_height="180dp"
android:layout_marginBottom="25dp"
android:paddingVertical="60dp"
android:text="@string/logintext"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="40sp" />
<TextView
android:id="@+id/useremail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="30dp"
android:text="@string/user_email"
android:textSize="20sp" />
<EditText
android:id="@+id/loginemailentryid"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="30dp"
android:layout_marginBottom="30dp"
android:autofillHints=""
android:hint="@string/common_signin_button_text"
android:inputType="textEmailAddress"
android:minHeight="48dp"
tools:ignore="TextContrastCheck" />
<TextView
android:id="@+id/passwordtext"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="30dp"
android:text="@string/password"
android:textSize="20sp" />
<EditText
android:id="@+id/loginpasswordentryid"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="30dp"
android:layout_marginBottom="30dp"
android:autofillHints=""
android:hint="@string/prompt_password"
android:inputType="textPassword"
android:minHeight="38dp"
tools:ignore="TextContrastCheck" />
<Button
android:id="@+id/loginbuttonid"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="30dp"
android:layout_marginBottom="25dp"
android:text="@string/login"
android:textSize="20sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="185dp"
android:orientation="horizontal">
<TextView
android:id="@+id/registeroption"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="50dp"
android:paddingHorizontal="40dp"
android:text="@string/register"
android:textAlignment="center"
android:textSize="15sp" />
<TextView
android:id="@+id/forgotpasswordoption"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingHorizontal="40dp"
android:text="@string/forgot_password_option"
android:textAlignment="center"
android:textColor="@color/design_default_color_primary"
android:textSize="15sp" />
</LinearLayout>
<com.google.android.material.bottomnavigation.BottomNavigationView
android:layout_width="match_parent"
android:layout_height="46dp"
android:background="?android:attr/windowBackground"
android:backgroundTint="@color/design_default_color_primary"
app:itemIconTint="#fff"
app:itemTextColor="#fff"
app:labelVisibilityMode="labeled"
app:menu="@menu/navigation_menu"
app:showAsAction="ifRoom" />
</LinearLayout>
Here is my navigation menu code:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/homenav"
android:title="@string/homeiconmenu"
android:enabled="true"
android:icon="@drawable/ic_home"
android:visible="true" />
<item
android:id="@+id/scoresnav"
android:title="@string/scoresiconmenu"
android:enabled="true"
android:icon="@drawable/ic_scores"
android:visible="true" />
<item
android:id="@+id/profilenav"
android:title="@string/profileiconmenu"
android:enabled="true"
android:icon="@drawable/ic_account"
android:visible="true" />
</menu>
Some of the posts I have already checked and tried:
android
xml
android-layout
android-bottomnavigationview
0 Answers
Your Answer