How to add a footer in ListView?

前端 未结 7 1558
时光取名叫无心
时光取名叫无心 2020-11-22 09:35

I am developing an application,In my application,I am using Listview for displaying data using dom parsing,I want to footer in listview,when i click footer additional more d

相关标签:
7条回答
  • 2020-11-22 10:08

    The activity in which you want to add listview footer and i have also generate an event on listview footer click.

      public class MainActivity extends Activity
    {
    
            @Override
            protected void onCreate(Bundle savedInstanceState)
             {
    
                super.onCreate(savedInstanceState);
                setContentView(R.layout.activity_main);
    
                ListView  list_of_f = (ListView) findViewById(R.id.list_of_f);
    
                LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    
                View view = inflater.inflate(R.layout.web_view, null);  // i have open a webview on the listview footer
    
                RelativeLayout  layoutFooter = (RelativeLayout) view.findViewById(R.id.layoutFooter);
    
                list_of_f.addFooterView(view);
    
            }
    
    }
    

    activity_main.xml

    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@drawable/bg" >
    
        <ImageView
            android:id="@+id/dept_nav"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@drawable/dept_nav" />
    
        <ListView
            android:id="@+id/list_of_f"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/dept_nav"
            android:layout_margin="5dp"
            android:layout_marginTop="10dp"
            android:divider="@null"
            android:dividerHeight="0dp"
            android:listSelector="@android:color/transparent" >
        </ListView>
    
    </RelativeLayout>
    
    0 讨论(0)
提交回复
热议问题