问题描述
所以最近,在Android Studio 2.2中,有了一个新的ConstraintLayout,使设计变得更加容易,但是与RelativeLayout
和Linearlayout
不同,我不能使用ScrollView
包围ConstraintLayot
.这可能吗?如果是这样,怎么办?
So recently, with Android Studio 2.2 there's a new ConstraintLayout that makes designing a lot easier, but unlike RelativeLayout
and Linearlayout
, I can't use a ScrollView
to surround ConstraintLayot
. Is this possible? If so, how?
即
<ScrollView 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"
tools:layout_editor_absoluteX="0dp"
tools:layout_editor_absoluteY="0dp">
<android.support.constraint.ConstraintLayout
android:id="@+id/constraintLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:layout_editor_absoluteX="0dp"
tools:layout_editor_absoluteY="0dp">
<!-- Have whatever children you want inside -->
</android.support.constraint.ConstraintLayout>
</ScrollView>
推荐答案
ScrollViews中的ConstraintLayout有一个错误,并且已修复. google已修复Android Studio 2.2预览版2(constraintlayout 1.0.0-alpha2)中的错误.
There was a bug with ConstraintLayout inside ScrollViews and it has been fixed. google has fixed the bug in Android Studio 2.2 Preview 2 (constraintlayout 1.0.0-alpha2).
检查此链接以获取新更新(预览2):在ScrollView和RecycleView中可以正常工作
Check this link for new update (Preview 2): works properly inside ScrollView and RecycleView
解决方案1:
解决方案2:
这篇关于是否可以将ConstraintLayout放入ScrollView中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!