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的上方

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

    待更

  • 相关阅读:
    C# Dictionary 字典
    int.Parse()与int.TryParse()
    jquery 随机数
    DateGradeView分页绑定
    使用tcpdump抓Android网络包
    Android快速开发框架——AndroidAnnotations(Code Diet)
    浅谈 android-query
    Android网络框架技术
    PHP: 深入了解一致性哈希
    png图片压缩优化
  • 原文地址:https://www.cnblogs.com/neillee/p/5402858.html
Copyright © 2011-2022 走看看