本文主要是介绍listView自定义footerView,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
网上找了许多自定义footerView相关的,但是没找到自己想要的,感觉推酷做的很不错,但是这样的没找到开源的T_T
但是我做了一个简单的demo
无非就是三大点:
1.列表——获取列表,添加数据适配器
2.数据适配器——列表项的数据提供者。为每一个列表项设置数据
3.数据——列表项数据的封装(bean)
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/linearLayout_dialog_view" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:gravity="center_horizontal" android:background="@color/white"> <ProgressBarandroid:id="@+id/imgView_listbottom_loading"style="@style/style_progressbar"android:layout_width="wrap_content"android:layout_height="wrap_content"android:src="@drawable/loading"android:indeterminateDuration="600" />//转速<TextView android:id="@+id/textView_listbottom" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="10dp" android:text="数据加载中……" /> </LinearLayout>
<style name="style_progressbar"><item name="android:indeterminateDrawable">@drawable/rotate_progressbar</item><item name="android:minWidth">60dip</item><item name="android:maxWidth">60dip</item><item name="android:minHeight">60dip</item><item name="android:maxHeight">60dip</item></style>
这style加在res目录下的values下
在drawable目录下,新建rotate_progressbar.xml
<rotate xmlns:android="http://schemas.android.com/apk/res/android" android:drawable="@drawable/progressbar3" //自取的图片android:fromDegrees="0"android:toDegrees="360"android:pivotX="50%"android:pivotY="50%">
</rotate>
自定义Progressbar有三种方式实现:动画,自定义颜色,图片。本文是以图片的方式实现
这篇关于listView自定义footerView的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!