android - 如何将高度设置为底部导航

标签 android material-design

因此支持V25。我们有一个名为底部导航的新组件。

按照设计指南,底部导航的高度应该是8dp ( https://material.io/guidelines/components/bottom-navigation.html#bottom-navigation-specs )

但我无法为其设置海拔

任何建议,示例将不胜感激。谢谢!

更新 XML 代码

<RelativeLayout
  android:layout_width="match_parent"
  android:layout_height="match_parent">

<android.support.design.widget.BottomNavigationView
    android:id="@+id/bottom_navigation"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:elevation="8dp"
    app:elevation="8dp"
    app:itemBackground="@color/colorPrimary"
    app:itemIconTint="@drawable/bottom_nav_color_state"
    app:itemTextColor="@drawable/bottom_nav_color_state"
    app:menu="@menu/bottom_navigation_main"/>

<FrameLayout
    android:id="@+id/contentFrame"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_above="@id/bottom_navigation"
    android:background="#EDEDED"/>

最佳答案

所以,现在 (25.1.0) 我们必须将 BNV 的 android:background 设置为 @android:color/white 才能有阴影。如果您设置为其他颜色(即您的原色),则不会显示

关于android - 如何将高度设置为底部导航,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41823599/

相关文章:

java - DialogFragment OnCreateView 与 OnCreateDialog 的自定义布局

java - 构建命令失败

java - Bottom Sheet 在 EXPANDED 和 HIDDEN 之间停止

android - 如何禁用 NestedScrollView&CollapsingToolbarLayout 的滚动,例如当下面没有更多内容时?

CSS/JS Card扩展效果?

android - 同一行的两个 TextInputLayout

android - 将多个标志传递给android中的 Intent

java - 只需按一次按钮

具有不同 float 标签和占位符的Android EditText

flutter - 当我滚动时,ListView 会上下移动 - flutter