Skip to content

mzlogin/WrapContentListView

Repository files navigation

WrapContentListView

A ListView which its height can wrap content even if it is nested in a ScrollView.

Although it's not a good idea to nest a ListView in a ScrollView, in Android Studio, a warning will be given after inspections:

Nested scrolling widgets

A scrolling widget such as a ScrollView should not contain any nested scrolling widgets since this has various usability issues

But if you really want to, this WrapContentListView can be a solution.

ScreenShots

Use normal ListView

unwanted

Use this WrapContentListView

wanted

Usage

<org.mazhuang.wrapcontentlistview.WrapContentListView
    android:id="@+id/list_wrap_content"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">
</org.mazhuang.wrapcontentlistview.WrapContentListView>

and you should call notifyDataSetChanged(); after dataset in ListAdapter changed.

About

A ListView which its height can wrap content even if it is nested in a ScrollView.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages