我有这样的代码:
<android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/swipeContainer"
xmlns:design="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:weightSum="1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:theme="@style/Theme.AppCompat"
tools:context="com.tag.instagramdemo.example.MainActivity"
android:background="@drawable/background1">
<ListView
android:id="@+id/lvRelationShip"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
</ListView>
<android.support.design.widget.BottomNavigationView
android:id="@+id/bottomBar"
android:layout_width="match_parent"
android:layout_height="64dp"
android:layout_gravity="bottom"
android:background="#ffffff"
xmlns:app="http://schemas.android.com/apk/res-auto"
app:itemIconTint="@color/text"
android:enabled="false"
app:itemTextColor="@color/text"
android:animateLayoutChanges="true"
android:clickable="false"
design:menu = "@menu/menu_main"
android:contextClickable="false"/>
当我使用这个布局时。我看不到底部的栏,只能看到列表视图。在最上面只有列表,没有其他的。
发布于 2018-02-25 19:56:31
我试着解决你的问题。我希望它对你有用:)请看一看并尝试一下
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:design="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/swipeContainer"
android:layout_above="@+id/bottomBar"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:theme="@style/Theme.AppCompat"
android:weightSum="1">
<ListView
android:id="@+id/lvRelationShip"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
</ListView>
</android.support.v4.widget.SwipeRefreshLayout>
<android.support.design.widget.BottomNavigationView
android:id="@+id/bottomBar"
android:layout_width="match_parent"
android:layout_height="64dp"
android:layout_alignParentBottom="true"
android:layout_gravity="bottom"
android:animateLayoutChanges="true"
android:background="#ffffff"
android:clickable="false"
android:contextClickable="false"
android:enabled="false"
design:menu="@menu/navigation" />
</RelativeLayout>发布于 2018-02-25 20:31:41
http://schemas.android.com/apk/res/android“xmlns:app="http://schemas.android.com/apk/res-auto”xmlns:design="http://schemas.android.com/apk/res-auto“....> https://medium.com/@chornenkyy.v/first-look-at-bottomnavigationview-from-android-design-library-8244de85b953中建议的design:menu
BottomNavigationView有一个方法菜单(InflateMenu),如果你在里面传递你的菜单资源文件,它将会工作。正确的想法和错误的命名空间出现在我的脑海中,所以我试着用自动解析属性的‘app’命名空间替换‘design’。而且它确实起作用了。专用于此视图的其他三个属性也是如此: itemBackground、itemIconTint、itemTextColor。
https://stackoverflow.com/questions/48973074
复制相似问题