Onur Ozbek Onur Ozbek - 1 year ago 174
Android Question

Navigation bar does not align and show icons

I'm building a navigation bar for my app but it is way off. Basically, I want my navbar to look something like this:

enter image description here.

But instead this was the result:

enter image description here

I have written all the necessary code for it but for some reason its giving me this junk. The following is my code:

bottom_navigation_layout.xml:

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">

<item
android:id="@+id/action_menu"
android:title="Menu"
android:enabled="true"
android:icon="@drawable/ic_menu"
app:showAsAction="ifRoom" />

<item
android:id="@+id/action_awards"
android:title="Awards"
android:enabled="true"
android:icon="@drawable/ic_prizes"
app:showAsAction="ifRoom" />

<item
android:id="@+id/action_messaging"
android:title="Messaging"
android:enabled="true"
android:icon="@drawable/ic_chat"
app:showAsAction="ifRoom" />

<item
android:id="@+id/action_game"
android:title="Games"
android:enabled="true"
android:icon="@drawable/ic_game"
app:showAsAction="ifRoom" />

<item
android:id="@+id/action_contacts"
android:title="Contacts"
android:enabled="true"
android:icon="@drawable/ic_friends"
app:showAsAction="ifRoom"
/>
</menu>


activity_feed.xml

<RelativeLayout
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"
tools:context="ca.ozbek.blur.view.FeedActivity">

<android.support.design.widget.BottomNavigationView
android:id="@+id/bottom_navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:menu="@menu/bottom_navigation_layout"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true">
</android.support.design.widget.BottomNavigationView>

</RelativeLayout>

Answer Source
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download