RefreashListView(自定义ListView)
来源:互联网 发布:贵阳大数据培训班 编辑:程序博客网 时间:2024/06/05 19:46
- 1.先写下拉刷新的头布局文件.注意,根部局必须是LinearLayout
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"><FrameLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingLeft="20dp" android:paddingRight="10dp" android:paddingTop="10dp" > <ImageView android:id="@+id/iv_arr" android:layout_width="40dp" android:layout_height="40dp" android:src="@drawable/common_listview_headview_red_arrow" android:layout_gravity="center" /> <ProgressBar android:id="@+id/pb_progress" android:layout_width="40dp" android:layout_height="40dp" android:layout_gravity="center" android:visibility="invisible" /></FrameLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:layout_gravity="center" android:gravity="center" android:paddingTop="10dp" > <TextView android:id="@+id/tv_title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="下拉刷新" android:textSize="20sp" /> <TextView android:id="@+id/tv_time" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="2016-7-7 15:00:00" android:textSize="16sp" android:paddingTop="10dp" /> </LinearLayout></LinearLayout>
- 自定义ListView,添加头布局
package com.itguang.dell_pc.myapplication.view;import android.content.Context;import android.util.AttributeSet;import android.view.View;import android.widget.ListView;import com.itguang.dell_pc.myapplication.R;/** * 作者: 小光哥 on 2016/7/7. * 邮箱: 1445037803@qq.com * 修订历史: * 描述: * ┏┓ ┏┓ * ┏┛┻━━━┛┻┓━━━━┻┓ * ┃ ┃ * ┃ ━ ┃ * ┃ > < ┃ * ┃ ┃ * ┃... ⌒ ... ┃ * ┃ ┃ * ┗━┓ ┏━┛ * ┃ ┃ Code is far away from bug with the animal protecting * ┃ 史 ┃ 神兽保佑,代码无bug * ┃ 诗 ┃ * ┃ 之 ┃ * ┃ 宠 ┃ * ┃ ┃ * ┃ ┗━━━┓ * ┃BUG天敌 ┣┓┣┓┣┓┣┓┣┓ * ┃ ┏┛ * ┗┓┓┏━┳┓┏┛ * ┃┫┫ ┃┫┫ * ┗┻┛ ┗┻┛ */public class RefreshListView extends ListView { private View mHeaderView; public RefreshListView(Context context) { super(context); initHeaderView(); } public RefreshListView(Context context, AttributeSet attrs) { super(context, attrs); initHeaderView(); } public RefreshListView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); initHeaderView(); } /** * 初始化头布局 */ private void initHeaderView() { mHeaderView = View.inflate(getContext(), R.layout.refeeash_header, null); this.addHeaderView(mHeaderView); mHeaderView.measure(0, 0);//先测量再拿到它的高度 int measuredHeight = mHeaderView.getMeasuredHeight(); mHeaderView.setPadding(0, -measuredHeight, 0, 0); }}
0 0
- RefreashListView(自定义ListView)
- 自定义 ListView
- 自定义ListView
- 自定义listview
- 自定义LISTVIEW
- 自定义ListView
- 自定义listview
- 自定义listview
- 自定义ListView
- 自定义ListView
- 自定义listview
- 自定义listview
- 自定义listview
- ListView-自定义
- ListView自定义
- 自定义ListView
- 自定义listView
- 自定义ListView
- Linux下安装软件的一般步骤
- 在NSObject类中,和继承它的类中,弹出UIAlertcontroller和push、present到其它界面
- Android中用native 修饰的方法学习
- VS2013+WDK8.1编写window驱动
- 工作杂谈
- RefreashListView(自定义ListView)
- AngularJSURL参数传递问题
- 统计分析学习之数值分析方法
- Spring是什么
- Caused by: org.apache.ibatis.builder.BuilderException: Error creating document instance.
- mingW与cygwin
- 只利用热点事件就能吸粉引流?白日做梦!
- 浅谈Java中的equals和==
- 简单dp算法——百炼06:股票买卖