Java – Android constraint layout renderproblems in nestedscrollview

I'm trying to add my contractlayout to nestedscrollview. When watching my contractlayout, everything looks good

But then including the layout in my nestedscrollview will collapse the contractlayout. (even if I use matching parent width / height in include and my CL)

This is actually an error in the previous version of contractlayout (~ pre beta). Google bug reports

I'm using Verion beta 4.link to Youtube androiddev channel

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>

nested_ 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"
    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>

Is there a solution?

resolvent:

God... You have to study for an hour without an answer. Create an so post and find the answer in 5 minutes

The problem described above is the same as that in Scrollview. The solution is to add

android:fillViewport="true"

To scrollable parent

So nested_ scrollview_ Layout.xml will be:

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

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>