亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何實現“BottomNavigationView”但在文本旁邊使用圖標而不是堆疊?

如何實現“BottomNavigationView”但在文本旁邊使用圖標而不是堆疊?

喵喔喔 2022-06-15 15:33:09
我正在開發一個應用程序,并且在我的“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;
查看完整描述

1 回答

?
阿晨1998

TA貢獻2037條經驗 獲得超6個贊

我發現這個庫實現了水平字體和圖標,它很棒。這是鏈接。



查看完整回答
反對 回復 2022-06-15
  • 1 回答
  • 0 關注
  • 262 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號