在Android中使用Scrollview内部的约束布局好吗?
我是一名OEM开发人员,在这里我们为所有应用程序使用通用GUI库。在我们的应用程序中,我们扩展了GUI库,它将ScrollView作为我的应用程序的基本布局。现在,我的团队计划在应用程序中使用约束布局。我们可以在滚动视图中使用约束布局吗 我使用Android设计工具将线性布局转换为约束布局。但是 滚动不起作用在Android中使用Scrollview内部的约束布局好吗?,android,android-layout,android-view,android-constraintlayout,android-scrollview,Android,Android Layout,Android View,Android Constraintlayout,Android Scrollview,我是一名OEM开发人员,在这里我们为所有应用程序使用通用GUI库。在我们的应用程序中,我们扩展了GUI库,它将ScrollView作为我的应用程序的基本布局。现在,我的团队计划在应用程序中使用约束布局。我们可以在滚动视图中使用约束布局吗 我使用Android设计工具将线性布局转换为约束布局。但是 滚动不起作用 <ScrollView style="@style/Body_ScrollView" android:id="@+id/no_sim_layout">
<ScrollView
style="@style/Body_ScrollView"
android:id="@+id/no_sim_layout">
<LinearLayout style="@style/Body.LinearLayout.No_Sim">
<-- All other child views are going here-->
</LinearLayout>
</ScrollView>
想要转换成
<ScrollView
style="@style/Body_ScrollView"
android:id="@+id/no_sim_layout">
<ConstrainLayout style="@style/Body.LinearLayout.No_Sim">
<-- All other child views are going here-->
</ConstrainLayout>
</ScrollView>
是的,约束布局必须首先理解这一点: ConstraintLayout的目的是通过对每个视图应用一些规则来优化和展平布局的视图层次结构,以避免嵌套。这建议使用相对布局规则 更重要的是,它提供了动态视图对齐特性,如约束、基线、视图链接和许多其他提供无缝展平层次结构的特性。如果我们在Scrollview中使用Constraint,我们就不需要像在LinearLayout和许多其他视图中进行称重那样管理每个视图属性。它更简单,并且直接从提供的依赖关系中获得好处
<ConstrintLayout>
<ScrollView>
<ConstrintLayout>
//Single ParentConstrain else child
</ConstrintLayout>
</ScrollView>
</ConstrintLayout>
//单亲子女
反过来说,这会使复杂的XML代码更难理解,并且很难根据机器运行时计算的权重和位置构建UI
<ConstrintLayout>
<ScrollView>
<LinearLayout>
//Many different view to manage view
</LinearLayout>
</ScrollView>
</ConstrintLayout>
约束直接受益于输入依赖关系
<ConstrintLayout>
<ScrollView>
<LinearLayout>
//Many different view to manage view
</LinearLayout>
</ScrollView>
</ConstrintLayout>
//许多不同的视图用于管理视图