一、概述
作为一名三年AndroID开发经验的程序员,今天和大家一起实战一款APP的首页功能,这个首页在我们平时接触中还是很常见的,虽然页面简单,但是里面涉及的功能点还是挺多的。代码如有不足的还望各路同仁指点一二。
页面中使用的开发库:
整个首页架构使用的是LRecyclerVIEw,包含下拉刷新和自动加载功能
compile 'com.github.jdsjlzx:LRecyclerVIEw:1.3.3'
无限循环轮播图使用的是convenIEntbanner,效果还是很顺畅的,还可以根据自己的需要修改过渡动画
compile 'com.bigkoo:convenIEntbanner:2.0.5'
图片加载使用的是glIDe图片库,里面的方法是自己封装的
网络请求依赖是okhttp,使用的开源库okgo
compile 'com.lzy.net:okgo:2.1.4'
其他的还是九宫格图
compile 'com.lzy.Widget:ninegrIDvIEw:0.2.0'
自动注解butterknife库等等
二、实现效果图
1.首页展示轮播图
2.下拉刷新
3.自动加载
4.cardvIEw水波纹动画
三、核心代码
LRecyclerVIEw作为主框架,轮播图以及分类网格列表作为header放在index_header.xml布局文件下。
IndexFragment.java
package com.czhappy.commonindexdemo.fragment;import androID.os.Bundle;import androID.support.v4.app.Fragment;import androID.support.v4.vIEw.VIEwPager;import androID.support.v7.Widget.linearlayoutmanager;import androID.vIEw.LayoutInflater;import androID.vIEw.VIEw;import androID.vIEw.VIEwGroup;import androID.Widget.AdapterVIEw;import androID.Widget.ImageVIEw;import androID.Widget.linearLayout;import androID.Widget.TextVIEw;import com.bigkoo.convenIEntbanner.ConvenIEntBanner;import com.bigkoo.convenIEntbanner.holder.CBVIEwHolderCreator;import com.czhappy.commonindexdemo.KuaiZhiApplication;import com.czhappy.commonindexdemo.R;import com.czhappy.commonindexdemo.adapter.Campaignlistadapter;import com.czhappy.commonindexdemo.adapter.Classflylistadapter;import com.czhappy.commonindexdemo.Jsonparse.JsONObject;import com.czhappy.commonindexdemo.Jsonparse.ReflectUtil;import com.czhappy.commonindexdemo.model.CampaignList;import com.czhappy.commonindexdemo.model.Classfly;import com.czhappy.commonindexdemo.model.IndexBanner;import com.czhappy.commonindexdemo.model.IndexBannerList;import com.czhappy.commonindexdemo.okhttp.LoadingDialogCallback;import com.czhappy.commonindexdemo.utils.Accordiontransformer;import com.czhappy.commonindexdemo.utils.API;import com.czhappy.commonindexdemo.utils.NetworkImageHolderVIEw;import com.czhappy.commonindexdemo.utils.ToastUtil;import com.czhappy.commonindexdemo.vIEw.GrIDVIEwForScrollVIEw;import com.github.jdsjlzx.interfaces.OnLoadMoreListener;import com.github.jdsjlzx.interfaces.OnRefreshListener;import com.github.jdsjlzx.recyclervIEw.LRecyclerVIEw;import com.github.jdsjlzx.recyclervIEw.LRecyclerVIEwAdapter;import com.github.jdsjlzx.recyclervIEw.Progressstyle;import com.lzy.okgo.OkGo;import java.util.ArrayList;import java.util.List;import butterknife.BindVIEw;import butterknife.ButterKnife;import okhttp3.Call;import okhttp3.Response;/** * Description: * User: chenzheng * Date: 2016/9/9 0009 * Time: 17:18 */public class IndexFragment extends Fragment implements VIEwPager.OnPagechangelistener{ @BindVIEw(R.ID.back_iv) ImageVIEw backIv; @BindVIEw(R.ID.layout_back) linearLayout layoutBack; @BindVIEw(R.ID.Title_tv) TextVIEw TitleTv; @BindVIEw(R.ID.right_tv) TextVIEw rightTv; @BindVIEw(R.ID.layout_right) linearLayout layoutRight; @BindVIEw(R.ID.campaign_recyclervIEw) LRecyclerVIEw mRecyclerVIEw; private VIEw mVIEw; private GrIDVIEwForScrollVIEw classflyGrIDvIEw; private linearLayout pointGroup;; private ConvenIEntBanner convenIEntBanner; private TextVIEw bannerTitleTv;; private List<String> networkImages = new ArrayList<String>(); private int lastposition = 0; private Campaignlistadapter campaignlistadapter; private Classflylistadapter classflylistadapter; private IndexBannerList indexBannerList; private CampaignList campaignList; private LRecyclerVIEwAdapter mLRecyclerVIEwAdapter; public int pageNum = 1; public int pageSize = 4; @OverrIDe public VIEw onCreateVIEw(LayoutInflater inflater,VIEwGroup container,Bundle savedInstanceState) { mVIEw = inflater.inflate(R.layout.fragment_index,container,false); ButterKnife.bind(this,mVIEw); initVIEw(); initClassfly(); return mVIEw; } private voID initVIEw() { backIv.setVisibility(VIEw.GONE); TitleTv.setText("快知网"); layoutRight.setVisibility(VIEw.INVISIBLE); campaignlistadapter = new Campaignlistadapter(getActivity()); mLRecyclerVIEwAdapter = new LRecyclerVIEwAdapter(campaignlistadapter); mRecyclerVIEw.setAdapter(mLRecyclerVIEwAdapter); mRecyclerVIEw.setLayoutManager(new linearlayoutmanager(getActivity())); mRecyclerVIEw.setRefreshProgressstyle(Progressstyle.linespinFadeLoader); mRecyclerVIEw.setArrowImageVIEw(R.drawable.ic_pulltorefresh_arrow); mRecyclerVIEw.setLoadingMoreProgressstyle(Progressstyle.BallSpinFadeLoader); //add a headerVIEw final VIEw header = LayoutInflater.from(getActivity()).inflate(R.layout.index_header,(VIEwGroup)mVIEw.findVIEwByID(androID.R.ID.content),false); classflyGrIDvIEw = (GrIDVIEwForScrollVIEw) header.findVIEwByID(R.ID.classfly_grIDvIEw); classflyGrIDvIEw.setFocusable(false); pointGroup = (linearLayout) header.findVIEwByID(R.ID.point_group); convenIEntBanner = (ConvenIEntBanner) header.findVIEwByID(R.ID.convenIEntBanner); bannerTitleTv = (TextVIEw) header.findVIEwByID(R.ID.banner_Title_tv); mLRecyclerVIEwAdapter.addheaderVIEw(header); mRecyclerVIEw.setonRefreshListener(new OnRefreshListener() { @OverrIDe public voID onRefresh() { pageNum = 1; doRequest(pageNum,true); requestBannerList(); } }); mRecyclerVIEw.setonLoadMoreListener(new OnLoadMoreListener() { @OverrIDe public voID onLoadMore() { pageNum++; doRequest(pageNum,false); } }); //设置头部加载颜色 mRecyclerVIEw.setheaderVIEwcolor(R.color.colorAccent,R.color.dark,androID.R.color.white); //设置底部加载颜色 mRecyclerVIEw.setFooterVIEwcolor(R.color.colorAccent,androID.R.color.white); //设置底部加载文字提示 mRecyclerVIEw.setFooterVIEwHint("拼命加载中","已经全部为你呈现了","网络不给力啊,点击再试一次吧"); mRecyclerVIEw.setRefreshing(true);// mLRecyclerVIEwAdapter.setonItemClickListener(new OnItemClickListener() {// @OverrIDe// public voID onItemClick(VIEw vIEw,int position) {//// }//// });//// mLRecyclerVIEwAdapter.setonItemLongClickListener(new OnItemLongClickListener() {// @OverrIDe// public voID onItemLongClick(VIEw vIEw,int position) {//// }// }); } private voID initClassfly() { List<Classfly> List = new ArrayList<Classfly>(); Classfly c1 = new Classfly("3","通知公告",R.mipmap.classfly_bg1); Classfly c2 = new Classfly("4","教育学习",R.mipmap.classfly_bg2); Classfly c3 = new Classfly("5","偶像明星",R.mipmap.classfly_bg3); Classfly c4 = new Classfly("6","特价优惠",R.mipmap.classfly_bg4); Classfly c5 = new Classfly("7","线下活动",R.mipmap.classfly_bg5); Classfly c6 = new Classfly("8","其它",R.mipmap.classfly_bg6); List.add(c1); List.add(c2); List.add(c3); List.add(c4); List.add(c5); List.add(c6); classflylistadapter = new Classflylistadapter(getActivity()); classflyGrIDvIEw.setAdapter(classflylistadapter); classflylistadapter.setItems(List); classflyGrIDvIEw.setonItemClickListener(new AdapterVIEw.OnItemClickListener() { @OverrIDe public voID onItemClick(AdapterVIEw<?> parent,VIEw vIEw,int position,long ID) { } }); } private voID doRequest(int page,final boolean isRefresh) { OkGo.post(API.GET_CAMPAIGN_List) .tag(this) .params("currentPage",String.valueOf(page)) .params("pageSize",String.valueOf(pageSize)) .execute(new LoadingDialogCallback(getActivity()) { @OverrIDe public voID onSuccess(String s,Call call,Response response) { if(isRefresh){ mRecyclerVIEw.refreshComplete(); }else { mRecyclerVIEw.loadMoreComplete(); } try { campaignList = (CampaignList) ReflectUtil .copy(CampaignList.class,new JsONObject(s)); } catch (Exception e) { e.printstacktrace(); } if (campaignList != null) { String result = campaignList.getResult(); if (API.SUCCESS.equals(result)) { int j = campaignList.getData().size(); if (isRefresh) { campaignlistadapter.clear(); } if (j != pageSize) { mRecyclerVIEw.setNoMore(true); } campaignlistadapter.addAll(campaignList.getData()); }else{ ToastUtil.show(getActivity(),campaignList.getMsg()); } } } @OverrIDe public voID onError(Call call,Response response,Exception e) { super.onError(call,response,e); if(isRefresh){ mRecyclerVIEw.refreshComplete(); }else { mRecyclerVIEw.loadMoreComplete(); } KuaiZhiApplication.showResultToast(getActivity(),call,e); } }); } private voID requestBannerList() { OkGo.post(API.GET_INDEX_BANNER_List) .tag(this) .cacheKey("cache_index_banner_List") .execute(new LoadingDialogCallback(getActivity()) { @OverrIDe public voID onCacheSuccess(String s,Call call) { super.onCacheSuccess(s,call); analysisIndexBannerRequest(s); } @OverrIDe public voID onSuccess(String s,Response response) { analysisIndexBannerRequest(s); } @OverrIDe public voID onError(Call call,e); KuaiZhiApplication.showResultToast(getActivity(),e); } }); } private voID analysisIndexBannerRequest(String s){ try { indexBannerList = (IndexBannerList) ReflectUtil .copy(IndexBannerList.class,new JsONObject(s)); } catch (Exception e) { e.printstacktrace(); } if (indexBannerList != null) { String result = indexBannerList.getResult(); if (API.SUCCESS.equals(result)) { networkImages.clear(); for (IndexBanner ib : indexBannerList.getData()) { networkImages.add(ib.getBanner_url()); } setRecommendInfo(); initBanner(); }else{ ToastUtil.show(getActivity(),indexBannerList.getMsg()); } } } private voID initBanner() { convenIEntBanner.setPages(new CBVIEwHolderCreator<NetworkImageHolderVIEw>() { @OverrIDe public NetworkImageHolderVIEw createHolder() { return new NetworkImageHolderVIEw(); } },networkImages) .setonPagechangelistener(this);//监听翻页事件 convenIEntBanner.setPagetransformer(new Accordiontransformer()); convenIEntBanner.startTurning(3000); convenIEntBanner.setonItemClickListener(new com.bigkoo.convenIEntbanner.Listener.OnItemClickListener() { @OverrIDe public voID onItemClick(int position) { } }); } private voID setRecommendInfo() { pointGroup.removeAllVIEws(); for (int i = 0; i < indexBannerList.getData().size(); i++) { // 添加指示点 ImageVIEw point = new ImageVIEw(getActivity()); linearLayout.LayoutParams params = new linearLayout.LayoutParams( linearLayout.LayoutParams.WRAP_CONTENT,linearLayout.LayoutParams.WRAP_CONTENT); if (i != indexBannerList.getData().size() - 1) { params.rightmargin = 10; } point.setLayoutParams(params); point.setBackgroundResource(R.drawable.point_bg); if (i == 0) { point.setEnabled(true); } else { point.setEnabled(false); } pointGroup.addVIEw(point); } } @OverrIDe public voID onPageScrolled(int position,float positionOffset,int positionOffsetPixels) { } @OverrIDe public voID onPageSelected(int position) { // 改变指示点的状态 // 把当前点enbale 为true if (indexBannerList != null && indexBannerList.getData() != null && indexBannerList.getData().size() > 0) { bannerTitleTv.setText(indexBannerList.getData().get(position).getBanner_Title()); } pointGroup.getChildAt(position).setEnabled(true); // 把上一个点设为false pointGroup.getChildAt(lastposition).setEnabled(false); lastposition = position; } @OverrIDe public voID onPageScrollStateChanged(int state) { }}
fragment_index.xml
<?xml version="1.0" enCoding="utf-8"?><linearLayout xmlns:androID="http://schemas.androID.com/apk/res/androID" xmlns:app="http://schemas.androID.com/apk/res-auto" androID:layout_wIDth="match_parent" androID:layout_height="match_parent" androID:background="@color/bg_color" androID:orIEntation="vertical"> <include androID:ID="@+ID/include_ID" layout="@layout/Titlelayout_theme" androID:layout_wIDth="match_parent" androID:layout_height="wrap_content" /> <com.github.jdsjlzx.recyclervIEw.LRecyclerVIEw androID:ID="@+ID/campaign_recyclervIEw" androID:layout_wIDth="match_parent" androID:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_vIEw_behavior"/></linearLayout>
index_header.xml
<?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="match_parent" androID:orIEntation="vertical"> <FrameLayout androID:layout_wIDth="match_parent" androID:layout_height="wrap_content"> <com.bigkoo.convenIEntbanner.ConvenIEntBanner xmlns:app="http://schemas.androID.com/apk/res-auto" androID:ID="@+ID/convenIEntBanner" androID:layout_wIDth="match_parent" androID:layout_height="@dimen/index_banner_height" app:canLoop="true" /> <linearLayout androID:layout_wIDth="match_parent" androID:layout_height="wrap_content" androID:layout_gravity="bottom" androID:background="@drawable/gradIEnt_bg" androID:gravity="center_vertical" androID:orIEntation="horizontal" androID:padding="10dp"> <TextVIEw androID:ID="@+ID/banner_Title_tv" androID:layout_wIDth="0dp" androID:layout_height="wrap_content" androID:layout_weight="1" androID:ellipsize="end" androID:singleline="true" androID:textcolor="@color/white" androID:textSize="@dimen/s_size" /> <linearLayout androID:ID="@+ID/point_group" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:gravity="center" androID:orIEntation="horizontal"></linearLayout> </linearLayout> </FrameLayout> <com.czhappy.commonindexdemo.vIEw.GrIDVIEwForScrollVIEw androID:ID="@+ID/classfly_grIDvIEw" androID:layout_wIDth="match_parent" androID:layout_height="wrap_content" androID:background="@color/white" androID:numColumns="3" /> <VIEw androID:layout_wIDth="match_parent" androID:layout_height="0.5dp" androID:background="#dddddd" /></linearLayout>
Campaignlistadapter.java
package com.czhappy.commonindexdemo.adapter;import androID.content.Context;import androID.support.v7.Widget.CardVIEw;import androID.vIEw.VIEw;import androID.Widget.ImageVIEw;import androID.Widget.linearLayout;import androID.Widget.TextVIEw;import com.czhappy.commonindexdemo.R;import com.czhappy.commonindexdemo.glIDe.GlIDeimgManager;import com.czhappy.commonindexdemo.model.Campaign;import com.czhappy.commonindexdemo.model.CampaignImage;import com.czhappy.commonindexdemo.utils.ToastUtil;import com.czhappy.commonindexdemo.utils.Utils;import com.lzy.ninegrID.ImageInfo;import com.lzy.ninegrID.NineGrIDVIEw;import com.lzy.ninegrID.prevIEw.NineGrIDVIEwClickAdapter;import java.util.ArrayList;import java.util.List;import butterknife.BindVIEw;import butterknife.ButterKnife;/** * Description: * User: chenzheng * Date: 2016/9/14 0014 * Time: 17:45 */public class Campaignlistadapter extends ListBaseAdapter<Campaign> { private Context mContext; @BindVIEw(R.ID.user_head_iv) ImageVIEw userheadIv; @BindVIEw(R.ID.username_tv) TextVIEw usernameTv; @BindVIEw(R.ID.createtime_tv) TextVIEw createtimeTv; @BindVIEw(R.ID.status_tv) TextVIEw statusTv; @BindVIEw(R.ID.Title_tv) TextVIEw TitleTv; @BindVIEw(R.ID.desc_tv) TextVIEw descTv; @BindVIEw(R.ID.campaign_time_tv) TextVIEw campaignTimeTv; @BindVIEw(R.ID.prise_iv) ImageVIEw priseIv; @BindVIEw(R.ID.prise_count_tv) TextVIEw priseCountTv; @BindVIEw(R.ID.comment_count_tv) TextVIEw commentCountTv; @BindVIEw(R.ID.nineGrID) NineGrIDVIEw nineGrID; @BindVIEw(R.ID.address_tv) TextVIEw addresstv; @BindVIEw(R.ID.cardVIEw) CardVIEw cardVIEw; @BindVIEw(R.ID.layout_address) linearLayout layoutAddress; public Campaignlistadapter(Context context) { super(context); this.mContext = context; } @OverrIDe public int getLayoutID() { return R.layout.campaign_List_item; } @OverrIDe public voID onBindItemHolder(SuperVIEwHolder holder,int position) { ButterKnife.bind(this,holder.itemVIEw); final Campaign campaign = mDataList.get(position); if(!Utils.isEmpty(campaign.getStart_time()) && Utils.isEmpty(campaign.getEnd_time())){ campaignTimeTv.setText("自"+Utils.StringDateFormat(campaign.getStart_time(),"yyyy-MM-dd HH:mm") + "起"); }else{ campaignTimeTv.setText(Utils.StringDateFormat(campaign.getStart_time(),"yyyy-MM-dd HH:mm") + "至" + Utils.StringDateFormat(campaign.getEnd_time(),"yyyy-MM-dd HH:mm")); } commentCountTv.setText(campaign.getComment_count()); createtimeTv.setText(campaign.getCreate_time()); descTv.setText(campaign.getCampaign_desc()); priseCountTv.setText(campaign.getPraise_count()); usernameTv.setText(campaign.getNickname()); if(!Utils.isEmpty(campaign.getCampaign_address())){ layoutAddress.setVisibility(VIEw.VISIBLE); addresstv.setText(campaign.getCampaign_address()); }else{ layoutAddress.setVisibility(VIEw.GONE); } if ("1".equals(campaign.getIs_praise())) { priseIv.setimageResource(R.mipmap.ding_checked_icon); } else { priseIv.setimageResource(R.mipmap.ding_uncheck_icon); } String statusstr = Utils.checkTimeStatus(campaign.getStart_time(),campaign.getEnd_time()); statusTv.setText(statusstr); if ("未开始".equals(statusstr)) { statusTv.setTextcolor(mContext.getResources().getcolor(R.color.blue)); } else if ("进行中".equals(statusstr)) { statusTv.setTextcolor(mContext.getResources().getcolor(R.color.red)); } else if ("已结束".equals(statusstr)) { statusTv.setTextcolor(mContext.getResources().getcolor(R.color.common_gray9)); } TitleTv.setText(campaign.getCampaign_name()); GlIDeimgManager.loadcircleimage(mContext,campaign.gethead_img(),userheadIv); ArrayList<ImageInfo> imageInfo = new ArrayList<>(); List<CampaignImage> images = campaign.getimg_List(); if (images != null) { for (CampaignImage image : images) { ImageInfo info = new ImageInfo(); info.setthumbnailUrl(image.getimage_url()); info.setBigImageUrl(image.getimage_url()); imageInfo.add(info); } } nineGrID.setAdapter(new NineGrIDVIEwClickAdapter(mContext,imageInfo)); if (images != null && images.size() == 1) { //nineGrID.setSingleImageRatio(images.get(0).getWIDth() * 1.0f / images.get(0).getHeight()); } cardVIEw.setonClickListener(new VIEw.OnClickListener() { @OverrIDe public voID onClick(VIEw v) { ToastUtil.show(mContext,campaign.getCampaign_name()); } }); }}
campaign_List_item.java
<?xml version="1.0" enCoding="utf-8"?><relativeLayout xmlns:androID="http://schemas.androID.com/apk/res/androID" xmlns:app="http://schemas.androID.com/apk/res-auto" androID:layout_wIDth="match_parent" androID:layout_height="wrap_content" androID:padding="5dp"> <androID.support.v7.Widget.CardVIEw androID:ID="@+ID/cardVIEw" androID:layout_wIDth="match_parent" androID:layout_height="wrap_content" androID:focusable="true" androID:clickable="true" androID:foreground="@drawable/card_foreground" app:cardCornerRadius="@dimen/card_radius" app:cardPreventCornerOverlap="false" app:elevation="3dp"> <linearLayout androID:layout_wIDth="match_parent" androID:layout_height="wrap_content" androID:orIEntation="vertical" androID:padding="8dp"> <linearLayout androID:layout_wIDth="match_parent" androID:layout_height="wrap_content" androID:gravity="center_vertical" androID:orIEntation="horizontal"> <ImageVIEw androID:ID="@+ID/user_head_iv" androID:layout_wIDth="40dp" androID:layout_height="40dp" androID:src="@mipmap/ic_img_user_default" /> <linearLayout androID:layout_wIDth="0dp" androID:layout_height="wrap_content" androID:layout_marginleft="8dp" androID:layout_weight="1" androID:orIEntation="vertical"> <TextVIEw androID:ID="@+ID/username_tv" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:text="zhangsan" androID:textcolor="@color/black" androID:textSize="@dimen/m_size" /> <TextVIEw androID:ID="@+ID/createtime_tv" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:text="2016-06-21 12:56:21" androID:textcolor="@color/common_gray9" androID:textSize="@dimen/ss_size" /> </linearLayout> <TextVIEw androID:ID="@+ID/status_tv" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:text="未开始" androID:textcolor="@color/common_gray9" androID:textSize="@dimen/s_size" /> </linearLayout> <TextVIEw androID:ID="@+ID/Title_tv" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:layout_margintop="10dp" androID:text="活动标题活动标题活动标题活动标" androID:textcolor="@color/common_gray3" androID:textSize="@dimen/s_size" /> <linearLayout androID:layout_wIDth="match_parent" androID:layout_height="wrap_content" androID:gravity="center_vertical" androID:layout_margintop="3dp" androID:orIEntation="horizontal"> <ImageVIEw androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:src="@mipmap/attend_time_icon_bg" /> <TextVIEw androID:ID="@+ID/campaign_time_tv" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:ellipsize="end" androID:maxlines="2" androID:layout_marginleft="5dp" androID:text="2016-06-21 12:56 - 2016-06-21 12:56" androID:textcolor="@color/common_gray9" androID:textSize="@dimen/s_size" /> </linearLayout> <linearLayout androID:ID="@+ID/layout_address" androID:layout_wIDth="match_parent" androID:layout_height="wrap_content" androID:gravity="center_vertical" androID:layout_margintop="3dp" androID:orIEntation="horizontal"> <ImageVIEw androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:src="@mipmap/address_icon_bg" /> <TextVIEw androID:ID="@+ID/address_tv" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:ellipsize="end" androID:maxlines="2" androID:layout_marginleft="5dp" androID:textcolor="@color/common_gray9" androID:textSize="@dimen/s_size" /> </linearLayout> <TextVIEw androID:ID="@+ID/desc_tv" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:layout_margintop="5dp" androID:ellipsize="end" androID:maxlines="2" androID:text="活动标题活动标题活动标题活动标题活动标题活动标题" androID:textcolor="@color/common_gray9" androID:textSize="@dimen/s_size" /> <com.lzy.ninegrID.NineGrIDVIEw androID:ID="@+ID/nineGrID" androID:layout_wIDth="match_parent" androID:layout_height="wrap_content" androID:layout_margintop="5dp" app:ngv_grIDSpacing="3dp" app:ngv_maxSize="9" app:ngv_mode="grID" app:ngv_singleImageRatio="1" app:ngv_singleImageSize="250dp"/> <linearLayout androID:layout_wIDth="match_parent" androID:layout_height="wrap_content" androID:layout_margintop="15dp" androID:gravity="center_vertical" androID:orIEntation="horizontal"> <VIEw androID:layout_wIDth="0dp" androID:layout_height="1dp" androID:layout_weight="1" /> <ImageVIEw androID:ID="@+ID/prise_iv" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:src="@mipmap/ding_uncheck_icon" /> <TextVIEw androID:ID="@+ID/prise_count_tv" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:layout_marginleft="5dp" androID:text="26" androID:textcolor="@color/common_gray6" androID:textSize="@dimen/s_size" /> <ImageVIEw androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:layout_marginleft="25dp" androID:src="@mipmap/comment_icon" /> <TextVIEw androID:ID="@+ID/comment_count_tv" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:layout_marginleft="5dp" androID:text="26" androID:textcolor="@color/common_gray6" androID:textSize="@dimen/s_size" /> </linearLayout> </linearLayout> </androID.support.v7.Widget.CardVIEw></relativeLayout>
四、源码下载
http://xiazai.jb51.net/201701/yuanma/AndroidAPPDemo(jb51.net).rar
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持编程小技巧。
总结以上是内存溢出为你收集整理的Android手把手教大家制作APP首页(下拉刷新、自动加载)全部内容,希望文章能够帮你解决Android手把手教大家制作APP首页(下拉刷新、自动加载)所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)