Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/340.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/184.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java NestedScrollView中的Android约束布局渲染器问题_Java_Android_Android Layout - Fatal编程技术网

Java NestedScrollView中的Android约束布局渲染器问题

Java NestedScrollView中的Android约束布局渲染器问题,java,android,android-layout,Java,Android,Android Layout,我正在尝试将ConstraintLayout添加到NestedScrollView。 检查我的约束布局时,一切看起来都很好 但是,将布局包括到嵌套的ScrollView中会折叠ContrainLayout(即使我在include和我的CL中使用了match parent width/heigt) 这实际上是以前版本的ContrainLayout(~pre-Beta)中的一个bug 我对Verion beta4采用这种方法 constraint_layout.xml: <android.su

我正在尝试将ConstraintLayout添加到NestedScrollView。 检查我的约束布局时,一切看起来都很好

但是,将布局包括到嵌套的ScrollView中会折叠ContrainLayout(即使我在include和我的CL中使用了match parent width/heigt)

这实际上是以前版本的ContrainLayout(~pre-Beta)中的一个bug

我对Verion beta4采用这种方法

constraint_layout.xml:

<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:id="@+id/coordinator_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:context="de.project.andy.aliver.JobCreatorActivity">

    <include layout="@layout/content_job_creator" />

    <android.support.design.widget.AppBarLayout
        android:id="@+id/app_bar"
        android:layout_width="match_parent"
        android:layout_height="145dp"
        android:fitsSystemWindows="true"
        android:theme="@style/AppTheme.AppBarOverlay">

        <android.support.design.widget.CollapsingToolbarLayout
            android:id="@+id/toolbar_layout"
            android:layout_width="match_parent"
            android:layout_height="143dp"
            android:fitsSystemWindows="true"
            app:contentScrim="?attr/colorPrimary"
            app:layout_scrollFlags="scroll|exitUntilCollapsed">

            <android.support.v7.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                app:layout_collapseMode="pin"
                app:popupTheme="@style/AppTheme.PopupOverlay" />

        </android.support.design.widget.CollapsingToolbarLayout>
    </android.support.design.widget.AppBarLayout>

    <android.support.design.widget.FloatingActionButton
        android:id="@+id/jc_fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@android:drawable/arrow_up_float"
        android:layout_gravity="end|bottom"
        app:fabSize="normal"
        android:layout_margin="15dp" />
</android.support.design.widget.CoordinatorLayout>
<android.support.v4.widget.NestedScrollView 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"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    tools:context="de.project.andy.aliver.JobCreatorActivity"
    tools:showIn="@layout/activity_job_creator">

    <include layout="@layout/constraint_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
</android.support.v4.widget.NestedScrollView>

嵌套的\u scrollview\u layout.xml:

<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:id="@+id/coordinator_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:context="de.project.andy.aliver.JobCreatorActivity">

    <include layout="@layout/content_job_creator" />

    <android.support.design.widget.AppBarLayout
        android:id="@+id/app_bar"
        android:layout_width="match_parent"
        android:layout_height="145dp"
        android:fitsSystemWindows="true"
        android:theme="@style/AppTheme.AppBarOverlay">

        <android.support.design.widget.CollapsingToolbarLayout
            android:id="@+id/toolbar_layout"
            android:layout_width="match_parent"
            android:layout_height="143dp"
            android:fitsSystemWindows="true"
            app:contentScrim="?attr/colorPrimary"
            app:layout_scrollFlags="scroll|exitUntilCollapsed">

            <android.support.v7.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                app:layout_collapseMode="pin"
                app:popupTheme="@style/AppTheme.PopupOverlay" />

        </android.support.design.widget.CollapsingToolbarLayout>
    </android.support.design.widget.AppBarLayout>

    <android.support.design.widget.FloatingActionButton
        android:id="@+id/jc_fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@android:drawable/arrow_up_float"
        android:layout_gravity="end|bottom"
        app:fabSize="normal"
        android:layout_margin="15dp" />
</android.support.design.widget.CoordinatorLayout>
<android.support.v4.widget.NestedScrollView 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"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    tools:context="de.project.andy.aliver.JobCreatorActivity"
    tools:showIn="@layout/activity_job_creator">

    <include layout="@layout/constraint_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
</android.support.v4.widget.NestedScrollView>


有解决办法吗?

天哪……在没有答复的情况下重新搜索了一个小时。 创建SO帖子并在5分钟后找到答案

上述问题与ScrollView中的问题相同。解决办法是增加

android:fillViewport="true"
到可滚动的父级

因此嵌套的_scrollview_layout.xml将是:

<android.support.v4.widget.NestedScrollView 
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:fillViewport="true"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="de.project.andy.aliver.JobCreatorActivity"
tools:showIn="@layout/activity_job_creator">

<include layout="@layout/constraint_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />
</android.support.v4.widget.NestedScrollView>

由于某些原因,Android Studio(从2.3.1开始)没有在NestedScrollView xml元素中自动建议此属性,因此我认为它不受支持。所以总是在这里帮忙:)