1.线性布局![](https://i-blog.csdnimg.cn/blog_migrate/804922639b2c641eab55b95df4494671.png)
2.网格布局
![](https://i-blog.csdnimg.cn/blog_migrate/ee7315645acd43620ec5297b27203ea2.png)
3.瀑布流布局
一.http
1.HttpConfig
public class HttpConfig {
public static String
goodslist_url =
"https://www.zhaoapi.cn/product/getCatagory"; }
二.model
1.GoodsListener
public interface GoodsListener { void getSuccess(String json); void getError(String error); }
2.IModel
public interface IModel { void getGoodsListData(String url,GoodsListener goodsListener); }
3.ModelImpl
public class ModelImpl
implements IModel{
@Override
public void getGoodsListData(String url,
final GoodsListener goodsListener) { HttpUtils httpUtils = HttpUtils.
getHttpUtils(); httpUtils.okGet(url); httpUtils.setOkLoadListener(
new OkLoadListener() {
@Override
public void okLoadSuccess(String json) {
goodsListener.getSuccess(json); }
@Override
public void okLoadError(String error) {
goodsListener.getError(error); } }); } }
三.presenter
1.IPresenter
public interface IPresenter { void showGoodsListToView(IModel iModel, IMainView iMainView); }
2.PresenterImpl
public class PresenterImpl implements IPresenter{ private static final String TAG = "PresenterImpl----"; @Override public void showGoodsListToView(IModel iModel, final IMainView iMainView) { iModel.getGoodsListData(HttpConfig.goodslist_url, new GoodsListener() { @Override public void getSuccess(String json) { Log.d(TAG, "getSuccess: "+json); Gson gson =new Gson(); UserBean userBean = gson.fromJson(json, UserBean.class); List<UserBean.DataBean> data = userBean.getData(); iMainView.showGoodsList(data); } @Override public void