How to create a ListView static header

I need my title in the list not to be scanned. I tried with addHeaderView, but to no avail. I do not want this to be done using Vertical LinearLayout with a fixed textview and listView inside it.

I need to make ListView static (uncrollable) header

Any solution for this?

Thanks in Advance :)

+4
source share
2 answers

You can simply place the title above the list in linearlayout mode.

Example:

<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <TextView android:id="@+id/texview" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/text" /> <ListView android:id="@+id/list" android:layout_width="fill_parent" android:layout_height="wrap_content" /> </LinearLayout> 
+2
source

This is not a very pleasant solution, but what you can try will give you the effect that you wnat. Aligns a ListView with a LinearLayout.

0
source

Source: https://habr.com/ru/post/1399760/


All Articles