2017-01-08 8 views
2

私はConstraintLayoutをNestedScrollViewに追加しようとしています。 私のContraintLayoutを見てみると、すべてがうまく見えます。Android Constraint Layout Renderproblems in NestedScrollView

しかし、その後崩壊ContraintLayoutは私NestedScrollViewにレイアウトを含む。(私は含まと私のCLでの対戦親幅/ heigtを使用していても)

これは実際には、以前のバージョンのバグでしたContraintLayout(〜preベータ版) 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要素でこの属性を自動的に提案しないため、サポートされていないと考えました。ので、常にここに役立ちます:) –

関連する問題