添加了上拉加载下拉刷新

This commit is contained in:
linglongxin24
2016-05-24 14:39:50 +08:00
parent 8bf98c660a
commit 832f82efb7
10 changed files with 284 additions and 225 deletions

View File

@@ -7,7 +7,7 @@
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
android:theme="@style/Theme.AppCompat.DayNight.NoActionBar">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

View File

@@ -1,11 +1,23 @@
package com.kejiang.yuandl.sample;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ListView;
import com.kejiang.yuandl.adapter.common.ViewHolder;
import com.kejiang.yuandl.adapter.common.abslistview.CommonAdapter;
import com.kejiang.yuandl.base.BaseActivity;
import com.ldd.pullview.AbPullToRefreshView;
import java.util.ArrayList;
import java.util.List;
public class MainActivity extends BaseActivity {
private AbPullToRefreshView pr;
private ListView listView;
private void assignViews() {
pr = (AbPullToRefreshView) findViewById(R.id.pr);
listView = (ListView) findViewById(R.id.listView);
}
@Override
public void initTitleBar() {
@@ -15,13 +27,31 @@ public class MainActivity extends BaseActivity {
@Override
public void initViews() {
setContentView(R.layout.activity_main);
setContentView(R.layout.ac_main);
assignViews();
}
@Override
public void initData() {
List<String> datas=new ArrayList<>();
listView.setAdapter(new CommonAdapter<String>(context,R.layout.item_text,datas){
@Override
public void convert(ViewHolder holder, String s) {
}
});
pr.setOnHeaderRefreshListener(new AbPullToRefreshView.OnHeaderRefreshListener() {
@Override
public void onHeaderRefresh(AbPullToRefreshView paramAbPullToRefreshView) {
}
});
pr.setOnFooterLoadListener(new AbPullToRefreshView.OnFooterLoadListener() {
@Override
public void onFooterLoad(AbPullToRefreshView paramAbPullToRefreshView) {
}
});
}
@Override

View File

@@ -6,11 +6,15 @@
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".sample.MainActivity">
android:paddingTop="@dimen/activity_vertical_margin">
<com.ldd.pullview.AbPullToRefreshView
android:layout_width="match_parent"
android:id="@+id/pr"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!" />
<ListView
android:id="@+id/listView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</com.ldd.pullview.AbPullToRefreshView>
</RelativeLayout>

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text"
android:id="@+id/textView"
android:layout_gravity="center_horizontal" />
</LinearLayout>