上拉刷新

匿名 (未验证) 提交于 2019-12-03 00:27:02

//主布局

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:app="http://schemas.android.com/apk/res-auto"     xmlns:tools="http://schemas.android.com/tools"     android:layout_width="match_parent"     android:layout_height="match_parent"     tools:context="com.example.a1.day9_xiala.MainActivity">     <com.handmark.pulltorefresh.library.PullToRefreshScrollView         android:id="@+id/pull_to_refresh_scrollview"         android:layout_width="fill_parent"         android:layout_height="fill_parent">         <com.example.a1.day9_xiala.MyListview             android:id="@+id/lis_view"             android:layout_width="match_parent"             android:layout_height="wrap_content"></com.example.a1.day9_xiala.MyListview>     </com.handmark.pulltorefr

//适配器

public class ListAdapter extends BaseAdapter{     private Context context;     private List<NewsBean.ResultBean.DataBean>list;      public ListAdapter(Context context, List<NewsBean.ResultBean.DataBean> list) {         this.context = context;         this.list = list;     }      @Override     public int getCount() {         return list.size();     }      @Override     public Object getItem(int position) {         return null;     }      @Override     public long getItemId(int position) {         return 0;     }      @Override     public View getView(int position, View convertView, ViewGroup parent) {         ViewHolder holder;         if (convertView==null){             convertView=View.inflate(context,R.layout.item_layout,null);             holder=new ViewHolder();             holder.textView=convertView.findViewById(R.id.text_title);             convertView.setTag(holder);         }else{             holder= (ViewHolder) convertView.getTag();         }       holder.textView.setText(list.get(position).getTitle());         return convertView;     }     class  ViewHolder{         TextView textView;     } }

//Activty


文章来源: 上拉刷新
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!