2017-01-08 2 views
2

내 ConstraintLayout을 NestedScrollView에 추가하려고합니다. ContraintLayout을 볼 때 모든 것이 잘 보입니다.안드로이드 제약 레이아웃 NestedScrollView의 Renderproblem

하지만 내 NestedScrollView에 레이아웃 붕괴 ContraintLayout. 포함 (나는에 일치하는 부모 폭/heigt를 사용하더라도를 포함 내 CL)에

이 실제로 이전 버전의 버그했다 ContraintLayout (~ 베타 이전). Google Bug Reports

나는 Verion beta4를 사용한이 접근 방식을 따르고 있습니다. 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> 

는 해결 방법이 있습니까?

답변

8

어 ... 답변없이 1 시간 동안 다시 방역하고 있습니다. 5 분 후에 SO 게시물을 작성하고 답변을 찾았습니다.

위에서 설명한이 문제는 ScrollView에서와 동일합니다. 해결책은 화면 이동 가능한 상위 항목에

android:fillViewport="true" 

을 추가하는 것입니다.

+0

Android Studio (2.3.1 현재)는 NestedScrollView xml 요소에서이 속성을 자동 제안하지 않으므로 지원되지 않습니다. 그래서 항상 여기에 도움이 :) –