美文网首页
一些问题

一些问题

作者: i冰点 | 来源:发表于2017-02-12 14:31 被阅读62次

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'
  }
}

参考:
As of v2.0 of the Gradle plugin, library resources are never rasterized so this should never happen(Android的光栅化 )

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被置于屏幕的不可见位置。。。

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);
还返券.gif

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

4、

相关文章

  • 时间是良药也是毒药

    时间会解决一些问题,时间也会让一些问题越发糟糕。

  • 周总结74

    还是会被一些问题“折磨”着 大脑已然快爆炸 一些问题没解决 又出现一些问题 可能人生即问题吧 无名的大志 胡兰成也...

  • 2018-01-13

    今天大糊涂对我的代码做了瘦身,发现了一些问题,修正了一些问题,规范了一些问题,小曾童鞋,正在让我学习发红包和发代金...

  • 元哲学

    哲学起源于一些问题,而一些问题又引发了另外一些问题,这些问题又引出了新的问题。 一些基本问题就像是:什么是意义?上...

  • 安装cocoaPods出错

    在安装mPaaS平台时,出现了一些问题,后来把ruby删除,cocoaPods卸载了,重新装,也是出现了一些问题:...

  • 59离开时才想的一些问题

    离开时才想的一些问题

  • 2021-02-01

    我状态又出了一些问题

  • iOS - 骨架屏集成问答文档和使用注意点

    前言 鉴于大家在集成TABAnimated的过程中,可能会遇到一些问题。有一些问题是对TABAnimated不够了...

  • 项目Scrum实施中的一些问题

    项目Scrum实施中的一些问题

  • 一些问题

    我是一个有些轻微心理问题的人。 累了一天回家,单位提拔年轻干部却因为对领导的不合,把自己耽搁了。 本是一个很单纯的...

网友评论

      本文标题:一些问题

      本文链接:https://www.haomeiwen.com/subject/aleaittx.html