滚动视图中的约束布局,始终引导高度变化
Constraintlayout inside scrollview ,always guideline height varies
NestedScrollView 中的 Constraintlayout,总是指导高度变化。
指南高度百分比效果不佳。它因 recylerview 和其他视图内容而异。如何解决这个问题,指导高度固定在 scrollview
代码
<android.support.v4.widget.NestedScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:fillViewport="true"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.constraint.ConstraintLayout
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:id="@+id/top_clay"
android:paddingLeft="0dp"
android:paddingRight="0dp">
<android.support.constraint.Guideline
android:id="@+id/guideline_graph"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.35" />
<TextView
android:id="@+id/vpager_dsv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@+id/guideline_graph" />
<android.support.v7.widget.RecyclerView
android:id="@+id/rcv"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:nestedScrollingEnabled="false"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/guideline_graph">
</android.support.v7.widget.RecyclerView>
</android.support.constraint.ConstraintLayout>
the {@code Guideline}{@see Guideline} object allows you to create *
Horizontal and Vertical guidelines which are positioned relative to
the {@code ConstraintLayout} container.
以上文字复制自约束布局文档。指南根据容器大小定位。因此,根据约束布局指南中的视图大小,其位置将有所不同。
我认为这种行为是意料之中的。
NestedScrollView 中的 Constraintlayout,总是指导高度变化。
指南高度百分比效果不佳。它因 recylerview 和其他视图内容而异。如何解决这个问题,指导高度固定在 scrollview
代码
<android.support.v4.widget.NestedScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:fillViewport="true"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.constraint.ConstraintLayout
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:id="@+id/top_clay"
android:paddingLeft="0dp"
android:paddingRight="0dp">
<android.support.constraint.Guideline
android:id="@+id/guideline_graph"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.35" />
<TextView
android:id="@+id/vpager_dsv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@+id/guideline_graph" />
<android.support.v7.widget.RecyclerView
android:id="@+id/rcv"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:nestedScrollingEnabled="false"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/guideline_graph">
</android.support.v7.widget.RecyclerView>
</android.support.constraint.ConstraintLayout>
the {@code Guideline}{@see Guideline} object allows you to create * Horizontal and Vertical guidelines which are positioned relative to the {@code ConstraintLayout} container.
以上文字复制自约束布局文档。指南根据容器大小定位。因此,根据约束布局指南中的视图大小,其位置将有所不同。
我认为这种行为是意料之中的。