Skip to content Skip to sidebar Skip to footer

Problem Removing Listview Footer Using Removefooterview()

I am trying to remove footer I've set using the same reference I used to set it up. However, nothing happens. protected void onPostExecute(ArrayList result) {

Solution 1:

You might have to call listView1.setAdapter(adapter) to refresh the listview. If that doesn't work, another solution is to make the height of the footer view to 0px. This is a better solution if you are planning to use the footer view later on again.

Solution 2:

You can also set the footer visibility for GONE. To do that, you need to wrap the content of your footer using a linearlayout, then you set the linearlayout visibility to GONE.

In the example bellow I set the visibility of LogoLinearLayout to GONE.

<?xml version="1.0" encoding="utf-8"?><LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"android:orientation="vertical"android:layout_width="match_parent"android:layout_height="wrap_content"><LinearLayoutandroid:id="@+id/LogoLinearLayout"android:orientation="vertical"android:layout_width="match_parent"android:layout_height="wrap_content"><ImageViewandroid:id="@+id/Logo"android:src="@drawable/Logo"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_marginTop="@dimen/spacing3"android:layout_marginBottom="@dimen/spacing3"android:layout_gravity="center" /></LinearLayout></LinearLayout>

Solution 3:

I have seen this type of solution (setting the footer view's height to 0, or setting negative margins..) on many posts related to hiding the footer issue, and it does work, but with 2 issues: - the list will not respect the transcriptMode="normal" anymore, in the sense that, if the last item is visible and a new item is added to the list, the list will not scroll to the newly added item; - when keyboard is shown and list size changed, the list again will not show you the last item.

Post a Comment for "Problem Removing Listview Footer Using Removefooterview()"