0
私のホームページには下のナビゲーションビューがあり、メニュー項目は4つあります。 onCreate()では、4つのメニュー項目が固定された位置になく、タップされたときにのみラベルが表示され、位置が変更されます。触れると位置を変えずに、ラベルを表示したまま固定しておきたい。下部ナビゲーションビューメニュー項目の位置を固定するにはどうすればいいですか?
<?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"
xmlns:design="http://schemas.android.com/tools">
<item
android:id="@+id/menu_home"
android:title="Home"
android:enabled="true"
android:icon="@drawable/home_icon"
app:showAsAction="always"/>
<item
android:id="@+id/menu_wallet"
android:title="Wallet"
android:enabled="true"
android:icon="@drawable/wallet_icon"
app:showAsAction="always"/>
<item
android:id="@+id/menu_toto"
android:title="Toto"
android:enabled="true"
android:icon="@drawable/toto_icon"
app:showAsAction="always"/>
<item
android:id="@+id/menu_settings"
android:title="Settings"
android:enabled="true"
android:icon="@drawable/setting_icon"
app:showAsAction="always"/>
</menu>
とメインXMLは、このようなものです::ここに私のxmlコードは、あなたのactivity_main.xmlファイルのコードに次のタグを追加
<android.support.design.widget.BottomNavigationView
android:id="@+id/navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
app:itemBackground="@color/homenavigationbottom"
app:itemTextColor="@android:color/white"
android:fitsSystemWindows="true"
app:menu="@menu/bottom_navigation_menu"/>
ルートは相対的なレイアウトなので、alignParナビゲーションビューではentBottom = trueだが助けにならなかった。他に何か ? –