<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. Please check whether I correctly implemented "Anchored the ListView to the top, bottom, left, and right edges of the constraint layout. "
if you want full anchored with Constraint layout then make your ListView's Height & Weight match_parent
your ListView code look like this
<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
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.