[英]I need to Anchored the ListView to the top, bottom, left, and right edges of the constraint layout
<ListView
android:layout_width="100dp"
android:layout_height="100dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
>
</ListView>
This is the list view that I have created in the XML file.这是我在 XML 文件中创建的列表视图。 Please check whether I correctly implemented "Anchored the ListView to the top, bottom, left, and right edges of the constraint layout. "请检查我是否正确实施了“将 ListView 锚定到约束布局的顶部、底部、左侧和右侧边缘。”
if you want full anchored with Constraint layout then make your ListView's Height & Weight match_parent
如果你想完全锚定约束布局,那么让你的 ListView 的高度和重量match_parent
your ListView code look like this你的 ListView 代码看起来像这样
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
>
</ListView>
and if you want to show your listView in content size then you need to make your height and weight like below如果你想以内容大小显示你的 listView 那么你需要像下面这样设置你的身高和体重
android:layout_width="wrap_content"
android:layout_height="wrap_content"
Hardcore size make your layout Responsive-less.铁杆尺寸使您的布局响应更少。 So, don't use hardcore size if you want to make your app responsive.因此,如果您想让您的应用程序具有响应性,请不要使用硬核尺寸。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.