1、This app has been built with an incorrect configuration...
1、Error
This app has been built with an incorrect configuration,Please configure your build for VectorDrawableCompat.
2、方案
将gradle升级到最新版本
buildscript {
...
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
}
}
2、FAB to hide when navigating between different fragments in a viewpager
FAB to hide when navigating between different fragments in a viewpager
3、在CoordinatorLayout + ActionBar时,FrameLayout被置于屏幕的不可见位置。。。

1、在FrameLayout上添加 android:paddingBottom="?attr/actionBarSize"
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.Toolbar
android:id="@+id/toolBar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_scrollFlags="scroll|enterAlways"
app:title="">
<ImageView
android:src="@drawable/ic_header_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_gravity="center"/>
</android.support.v7.widget.Toolbar>
</android.support.design.widget.AppBarLayout>
<FrameLayout
android:id="@+id/fragmentContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:paddingBottom="56dp"/>
<com.ashokvarma.bottomnavigation.BottomNavigationBar
android:id="@+id/bottomNavigationBar"
android:layout_width="wrap_content"
android:layout_height="56dp"
app:bnbAutoHideEnabled="false"
android:layout_gravity="bottom" />
</android.support.design.widget.CoordinatorLayout>
2、Bring the AppBarLayout and Toolbar into your fragment. The fragment can set up the supportActionBar
on the Toolbar and do everything that would normally be done in the activity.
main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.hqgj.aishang.MainActivity">
<FrameLayout
android:id="@+id/fragmentContainer"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
<com.ashokvarma.bottomnavigation.BottomNavigationBar
android:id="@+id/bottomNavigationBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
fragment.xml
<android.support.design.widget.CoordinatorLayout
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">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:elevation="0dp">
<android.support.v7.widget.Toolbar
android:id="@+id/toolBar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_scrollFlags="scroll|enterAlways"
app:title="">
<ImageView
android:src="@drawable/ic_header_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_gravity="center"/>
</android.support.v7.widget.Toolbar>
<com.hqgj.aishang.ui.TabLayoutIndicator
android:id="@+id/tabLayout"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_marginBottom="4dp"
/>
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="@+id/viewPager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
</android.support.design.widget.CoordinatorLayout>
Fragment.java
toolBar.setTitle("");
((AppCompatActivity)mListener).setSupportActionBar(toolBar);

3、添加Space
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout 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"
tools:context="com.hqgj.aishang.activity.CircleDetailActivity">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:elevation="1dp"
>
...
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:id="@+id/scrollView"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<RelativeLayout android:layout_width="match_parent"
android:id="@+id/container"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:background="@android:color/white">
...
<Space
android:layout_below="@+id/remarkInfo"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_alignParentBottom="true"/>
</RelativeLayout>
</android.support.v4.widget.NestedScrollView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="48dp"
android:orientation="vertical"
android:layout_gravity="bottom">
...
</LinearLayout>
</android.support.design.widget.CoordinatorLayout>
CoordinatorLayout + ActionBar + Fragments
Hide Toolbar in activity from fragment using CoordinatorLayout
网友评论