我正在開發一個應用程序,并且在我的“activity_main.xml”布局中實現了一個 BottomNavigationView,但是在看到Material.io的指導方針之后,我注意到文本旁邊有一個帶有圖標的圖像,而不是堆疊在一起。我想知道是否可以像這樣實現我的底部導航。我嘗試訪問 BottomNavigationMenuView,但我仍在學習 Java 類。這是我的 activity_main.xml 布局代碼<?xml version="1.0" encoding="utf-8"?><androidx.constraintlayout.widget.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/tab_layout"android:layout_width="match_parent"android:layout_height="match_parent"tools:context=".MainActivity"><com.errorerrorerror.espledwifi.CurvedBottomNavigationView android:id="@+id/customBottomBar" android:layout_width="match_parent" android:layout_height="120dp" android:theme="@style/Widget.BottomNavigationView" app:itemBackground="@drawable/image_icon_font_bottom_view" app:itemIconTint="@color/color_font_icon_bottom_nav" app:itemTextColor="@color/color_font_icon_bottom_nav" app:labelVisibilityMode="selected" app:layout_constraintBottom_toBottomOf="parent" app:menu="@menu/bottom_nav_menu" /></androidx.constraintlayout.widget.ConstraintLayout>這是我在 MainActivity.java 中的代碼。我為我的 BottomNavigation 創建了一個自定義類。package com.errorerrorerror.espledwifi;import android.graphics.Color;import androidx.appcompat.app.AppCompatActivity;import android.os.Bundle;import android.util.DisplayMetrics;import android.util.TypedValue;import android.view.Menu;import android.view.View;import android.view.ViewGroup;import android.view.ViewOutlineProvider;import com.errorerrorerror.espledwifi.R;import com.google.android.material.bottomnavigation.BottomNavigationMenuView;
添加回答
舉報
0/150
提交
取消