【发布时间】:2017-08-23 05:09:33
【问题描述】:
我想制作一个允许我使用约束布局向下滚动的布局,但我不知道该怎么做。 ScrollView 是否应该像这样成为 ConstraintLayout 的父级?
<?xml version="1.0" encoding="utf-8"?>
<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"
android:fillViewport="true">
<android.support.constraint.ConstraintLayout
android:id="@+id/Constraint"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
或者反过来呢?也许有人可以为我指出一个很好的教程或举个例子,我似乎找不到。
另外,我不知道这是一个错误还是我没有设置的一些配置,但我见过这样的图像:
在蓝图“蓝色矩形”之外有一些组件但它们是可见的,而在我这边,如果我将组件放在“空白区域”上,我看不到它或将其移动到任何地方,它会出现在组件树。
更新:
我在设计工具中找到了一种使约束布局可滚动的方法,使用水平准线将约束布局边框下推并延伸到设备之外,之后,您可以使用该准线作为新的底部约束布局以锚定组件。
【问题讨论】:
标签: android android-layout android-scrollview android-constraintlayout