我想在UpperCase中制作BottomNavigationView菜单,如何在不使用第3方库的情况下做到这一点?
这是我的xml代码:
<android.support.design.widget.BottomNavigationView
android:id="@+id/navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="@android:color/white"
android:foreground="?attr/selectableItemBackground"
app:itemIconTint="@color/bottom_nav_color"
app:itemTextColor="@color/bottom_nav_color"
app:menu="@menu/navigation" />
和navigation.xml如下:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/navigation_home"
android:icon="@drawable/home_icon"
android:title="@string/title_home"
/>
<item
android:id="@+id/navigation_deals"
android:icon="@drawable/ic_deals"
android:title="@string/deals" />
<item
android:id="@+id/navigation_myBookings"
android:icon="@drawable/ic_my_bookings"
android:title="@string/title_my_bookings" />
<item
android:id="@+id/navigation_more"
android:icon="@drawable/ic_more"
android:title="@string/title_more" />
</menu>
答案 0 :(得分:2)
尝试一下
创建这样的样式 BottomNavigationViewStyle
<style name="BottomNavigationViewStyle">
<item name="android:textAllCaps">true</item>
<item name="android:textSize">15sp</item>
</style>
比这样使用
<android.support.design.widget.BottomNavigationView
android:id="@+id/navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_gravity="bottom"
android:background="@android:color/white"
android:foreground="?attr/selectableItemBackground"
app:menu="@menu/navigation"
app:theme="@style/BottomNavigationViewStyle" />
输出
答案 1 :(得分:0)
将此主题应用于您的底部导航
<!-- Reveal with active button -->
<button id="btn1">Reveal Frame 1</button>
<button id="btn2">Reveal Frame 2</button>
<br>
<!-- Reveal with checked radio -->
<input type="radio" id="rd1" name="reveal">
<label for="rd1">Reveal Frame 1</label>
<input type="radio" id="rd2" name="reveal">
<label for="rd2">Reveal Frame 2</label>
<br>
<!-- Reveal with checked checkbox -->
<input type="checkbox" id="cb1">
<label for="cb1">Reveal Frame 1</label>
<input type="checkbox" id="cb2">
<label for="cb2">Reveal Frame 2</label>
<div>
<iframe width="100px" id="if1" src="http://google.com">Test</iframe>
<iframe width="200px" id="if2" src="http://amazon.com">Test</iframe>
</div>