zoukankan      html  css  js  c++  java
  • ListView的HeaderView和Footer

    HeaderView介绍

    HeaderView用法

    属性中添加

    ListView中属性listHeader和overScrollHeader区别:

        android:overScrollHeader="@layout/header"
        tools:listheader="@layout/header"
    

    java代码中添加

    listView通过以下方法添加

        listView.addHeaderView(header1);
        listView.addHeaderView(header2, null, false);
    

    其中第二种方法的注释及方法声明如下:

    /**
         * Add a fixed view to appear at the top of the list. If this method is
         * called more than once, the views will appear in the order they were
         * added. Views added using this call can take focus if they want.
         * <p>
         * Note: When first introduced, this method could only be called before
         * setting the adapter with {@link #setAdapter(ListAdapter)}. Starting with
         * {@link android.os.Build.VERSION_CODES#KITKAT}, this method may be
         * called at any time. If the ListView's adapter does not extend
         * {@link HeaderViewListAdapter}, it will be wrapped with a supporting
         * instance of {@link WrapperListAdapter}.
         *
         * @param v The view to add.
         * @param data Data to associate with this view
         * @param isSelectable whether the item is selectable
         */
        public void addHeaderView(View v, Object data, boolean isSelectable) 
    

    headerView的添加有顺序性,即此处header1在header的上方

    ----------分割线------------

    待更

  • 相关阅读:
    遥控器拆卸记录
    计算器拆卸记录
    no matching constructor for initialization
    STL
    排序方法
    二叉树之广度优先遍历
    C++之queue学习记录
    方向电路
    站间联系电路
    求二叉树的最大深度
  • 原文地址:https://www.cnblogs.com/neillee/p/5402858.html
Copyright © 2011-2022 走看看