【问题标题】:Do you use Scroll View with Constraint Layout?您是否使用带有约束布局的滚动视图?
【发布时间】:2021-04-18 12:21:49
【问题描述】:
我打算将 Login screen 从 Adobe XD 复制到 Android Studio(我刚刚开始了解这一点),但我不明白在这种情况下您如何实现滚动视图,您可以使用约束来设计所有内容布局,除了那个小的向下滚动阅读“已经有一个帐户?登录”
我看过的几乎所有教程都使用线性布局和相对布局。
你是怎么处理的?
【问题讨论】:
标签:
android-studio
user-interface
scroll
responsive-design
android-constraintlayout
【解决方案1】:
您可以在约束布局中轻松使用滚动视图
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true"
tools:ignore="contentDescription">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimaryDark_bc">
<!--set here your component like button, textview and other stuff-->
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>