【发布时间】:2017-03-27 06:21:24
【问题描述】:
是否可以在 android 中为底部导航栏设置顶部边框,如果可以的话告诉我如何做到这一点,我正在使用 android 的新底部导航视图。 这是我的代码
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/app_bar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_alignParentTop="true">
<include
android:id="@+id/gamebar"
layout="@layout/gamebar_layout"
/>
<include
android:id="@+id/toolbar"
layout="@layout/toolbar_layout" />
</LinearLayout>
<!-- Let's add fragment -->
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/app_bar_layout"
android:layout_above="@+id/bottom_navigation"
android:id="@+id/contentContainer"/>
<android.support.design.widget.BottomNavigationView
android:id="@+id/bottom_navigation"
android:layout_width="match_parent"
android:layout_height="56dp"
android:layout_alignParentBottom="true"
app:itemBackground="@color/BottomNavigationBgColor"
app:itemIconTint="@color/CelestialBlue"
app:itemTextColor="@color/CelestialBlue"
app:menu="@menu/bottom_navigation_main" />
</RelativeLayout>
【问题讨论】:
-
@FerdousAhamed:rafsanahmad007(通过使用视图)已经给出了相同的答案,但我感谢您的努力。
-
您的问题目前处于什么状态?
-
@FerdousAhamed:我正在寻找一些用于设置边框的 xml 属性,但我认为它不存在..
-
是的,没有设置上边框的属性。您必须使用其他视图/视图组来创建它。
-
如果您不想使用 VIEW,那么您可以通过其他方式进行。请参阅我的更新答案。谢谢~
标签: android android-layout bottomnavigationview