I need to create Bottom Navigation with two menu item. but the view ratio is 30:70 and text gravity is in centre. one menu contain image and text one is only text
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/bottom_navigation_1"
android:icon="@drawable/ic_symbol1"
android:title="@string/bottom_navigation_title1"
app:showAsAction="always|withText" />
<item
android:id="@+id/bottom_navigation_2"
android:icon="@drawable/ic_symbol2"
android:title="@string/bottom_navigation_title2"
app:showAsAction="always|withText" />
Below code in main layout
<android.support.design.widget.BottomNavigationView
android:state_enabled="true"
android:id="@+id/home_screen_bottom_navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginEnd="0dp"
android:layout_marginStart="0dp"
android:background="?android:attr/windowBackground"
app:menu="@menu/bottom_navigation1" />
I need to create Bottom Navigation with two menu item. but the view ratio is 30:70 and text gravity is in centre. one menu contain image and text one is only text
AFAIK
you can not achieve using menu better to create custom layout for this
Sample code
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_margin="10dp"
android:layout_alignParentBottom="true"
android:orientation="horizontal"
android:weightSum="1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_message"
android:gravity="center"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:textStyle="bold"
android:textColor="#FFFFFF"
android:background="#24edf1"
android:text="Message" />
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight=".7"
android:padding="5dp"
android:textStyle="bold"
android:textColor="#24edf1"
android:background="#dedbdb"
android:gravity="center"
android:text="BUY" />
</LinearLayout>
OUTPUT