流失布局

package zhoukao1.bwie.com.mvpapplication.activity;

import android.content.Context;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;

import com.google.gson.Gson;

import java.util.ArrayList;
import java.util.List;

import zhoukao1.bwie.com.mvpapplication.Bean.Lishi;
import zhoukao1.bwie.com.mvpapplication.Bean.ListBean;
import zhoukao1.bwie.com.mvpapplication.GoodView;
import zhoukao1.bwie.com.mvpapplication.R;
import zhoukao1.bwie.com.mvpapplication.mvp.view.AbnerMing;
import zhoukao1.bwie.com.mvpapplication.net.Hepler;

public class GoodsActivityPresenter extends AbnerMing implements View.OnClickListener {

    private GoodView mGoodsView;
    private GoodView mGoodsViewB;
    private EditText mEditText;

    @Override
    public int getLayoutId() {
        return R.layout.goog;
    }

    @Override
    public void initData() {
        super.initData();
        mGoodsView = (GoodView) get(R.id.goods_view_top);
        mGoodsViewB = (GoodView) get(R.id.goods_view_bottom);
        mEditText = (EditText) get(R.id.goods_txt);

        doHttpHot();

        setClick(this, R.id.seach_msg);
    }

    List<Lishi.DatasBean> list = new ArrayList<>();
    private void doHttpHot() {
        String url="http://ftp6252741.host709.zhujiwu.me/goods/goods_hot.txt";
        new Hepler().get(url).result(new Hepler.HttpListener() {
            @Override
            public void success(String data) {
                Lishi lishi = new Gson().fromJson(data, Lishi.class);
                List<Lishi.DatasBean> datas = lishi.getDatas();
                mGoodsView.setList(datas);
            }

        });
    }

    public Context context;

    @Override
    public void getContext(Context context) {
        this.context = context;
    }



    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.seach_msg://搜索
                String messs = mEditText.getText().toString().trim();
                if (TextUtils.isEmpty(messs)) {
                    Toast.makeText(context, "请输入要搜索的商品", Toast.LENGTH_SHORT).show();
                    return;
                }
                Lishi.DatasBean bean = new Lishi.DatasBean();
                bean.setName(messs);
                list.add(bean);
                mGoodsViewB.setList(list);
                break;
        }
    }
}

=============================

package zhoukao1.bwie.com.mvpapplication;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import java.util.List;

import zhoukao1.bwie.com.mvpapplication.Bean.Lishi;

public class GoodView extends RelativeLayout {

    private LinearLayout mLyoutV;
    private View view;

    public GoodView(Context context) {
        super(context);
        init(context);
    }

    public GoodView(Context context, AttributeSet attrs) {
        super(context, attrs);
        init(context);
    }

    public GoodView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        init(context);
    }

    private Context context;

    private void init(Context context) {
        this.context = context;
        //创建垂直的LinearLayout
        view = View.inflate(context, R.layout.good_v, null);
        mLyoutV = (LinearLayout) view.findViewById(R.id.lyout_v);
        //创建水平的
        addView(view);
    }

    public void setList(List<Lishi.DatasBean> list) {
        mLyoutV.removeAllViews();
        //创建水平layout
        LinearLayout view_h = (LinearLayout) View.inflate(context, R.layout.good_h, null);
        mLyoutV.addView(view_h);
        int len = 0;
        view_h.removeAllViews();
        for (int a = 0; a < list.size(); a++) {
            String msg = list.get(a).getName();
            len += msg.length();
            if (len > 22) {
                view_h = (LinearLayout) View.inflate(context, R.layout.good_h, null);
                mLyoutV.addView(view_h);
                len = 0;
            }
            //创建展示内容的layout
            View viewContent = View.inflate(context, R.layout.good_center, null);
            TextView textView = (TextView) viewContent.findViewById(R.id.tv_content);
            textView.setText(msg);
            view_h.addView(viewContent);

            //设置parmars

            LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) viewContent.getLayoutParams();
            params.weight = 1;
            params.leftMargin = 5;
            params.topMargin = 5;
            viewContent.setLayoutParams(params);
        }

    }
}

=====================布局

<?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"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#e8e8e8"
    android:orientation="vertical"
    tools:context=".activity.MainActivity">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:weightSum="1"
        >
        <EditText
            android:layout_width="0dp"
            android:layout_height="50dp"
            android:layout_weight="0.8"
            android:layout_margin="5dp"
            android:hint="请输入商品名称"
            android:background="@drawable/bian"
            android:paddingLeft="10dp"
            android:gravity="center_vertical"
            android:id="@+id/goods_txt"
            />
        <TextView
            android:layout_width="0dp"
            android:layout_weight="0.2"
            android:layout_height="wrap_content"
            android:text="搜索"
            android:background="@drawable/cen"
            android:paddingTop="10dp"
            android:paddingBottom="10dp"
            android:gravity="center_horizontal"
            android:layout_marginRight="5dp"
            android:id="@+id/seach_msg"
            />
    </LinearLayout>

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="热门搜索"
        android:textColor="#d43c3c"
        android:layout_marginLeft="8dp"
        android:layout_marginTop="5dp"
        />
    <zhoukao1.bwie.com.mvpapplication.GoodView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/goods_view_top"
        android:layout_marginTop="8dp"
        />
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="历史搜索"
        android:textColor="#d43c3c"
        android:layout_marginLeft="8dp"
        android:layout_marginTop="5dp"
        />
    <zhoukao1.bwie.com.mvpapplication.GoodView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/goods_view_bottom"
        android:layout_marginTop="8dp"
        />

</LinearLayout>

===========================

<?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"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    tools:context=".activity.MainActivity">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:id="@+id/lyout_v"
        />

</RelativeLayout>

=======================

<?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"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    tools:context=".activity.MainActivity">


</LinearLayout>

==========================

<?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"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@drawable/cen"
    android:paddingTop="10dp"
    android:paddingBottom="10dp"
    tools:context=".activity.MainActivity">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/tv_content"
        android:layout_centerInParent="true"
        />

</RelativeLayout>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
资源包主要包含以下内容: ASP项目源码:每个资源包中都包含完整的ASP项目源码,这些源码采用了经典的ASP技术开发,结构清晰、注释详细,帮助用户轻松理解整个项目的逻辑和实现方式。通过这些源码,用户可以学习到ASP的基本语法、服务器端脚本编写方法、数据库操作、用户权限管理等关键技术。 数据库设计文件:为了方便用户更好地理解系统的后台逻辑,每个项目中都附带了完整的数据库设计文件。这些文件通常包括数据库结构图、数据表设计文档,以及示例数据SQL脚本。用户可以通过这些文件快速搭建项目所需的数据库环境,并了解各个数据表之间的关系和作用。 详细的开发文档:每个资源包都附有详细的开发文档,文档内容包括项目背景介绍、功能模块说明、系统流程图、用户界面设计以及关键代码解析等。这些文档为用户提供了深入的学习材料,使得即便是从零开始的开发者也能逐步掌握项目开发的全过程。 项目演示与使用指南:为帮助用户更好地理解和使用这些ASP项目,每个资源包中都包含项目的演示文件和使用指南。演示文件通常以视频或图文形式展示项目的主要功能和操作流程,使用指南则详细说明了如何配置开发环境、部署项目以及常见问题的解决方法。 毕业设计参考:对于正在准备毕业设计的学生来说,这些资源包是绝佳的参考材料。每个项目不仅功能完善、结构清晰,还符合常见的毕业设计要求和标准。通过这些项目,学生可以学习到如何从零开始构建一个完整的Web系统,并积累丰富的项目经验。
资源包主要包含以下内容: ASP项目源码:每个资源包中都包含完整的ASP项目源码,这些源码采用了经典的ASP技术开发,结构清晰、注释详细,帮助用户轻松理解整个项目的逻辑和实现方式。通过这些源码,用户可以学习到ASP的基本语法、服务器端脚本编写方法、数据库操作、用户权限管理等关键技术。 数据库设计文件:为了方便用户更好地理解系统的后台逻辑,每个项目中都附带了完整的数据库设计文件。这些文件通常包括数据库结构图、数据表设计文档,以及示例数据SQL脚本。用户可以通过这些文件快速搭建项目所需的数据库环境,并了解各个数据表之间的关系和作用。 详细的开发文档:每个资源包都附有详细的开发文档,文档内容包括项目背景介绍、功能模块说明、系统流程图、用户界面设计以及关键代码解析等。这些文档为用户提供了深入的学习材料,使得即便是从零开始的开发者也能逐步掌握项目开发的全过程。 项目演示与使用指南:为帮助用户更好地理解和使用这些ASP项目,每个资源包中都包含项目的演示文件和使用指南。演示文件通常以视频或图文形式展示项目的主要功能和操作流程,使用指南则详细说明了如何配置开发环境、部署项目以及常见问题的解决方法。 毕业设计参考:对于正在准备毕业设计的学生来说,这些资源包是绝佳的参考材料。每个项目不仅功能完善、结构清晰,还符合常见的毕业设计要求和标准。通过这些项目,学生可以学习到如何从零开始构建一个完整的Web系统,并积累丰富的项目经验。
资源包主要包含以下内容: ASP项目源码:每个资源包中都包含完整的ASP项目源码,这些源码采用了经典的ASP技术开发,结构清晰、注释详细,帮助用户轻松理解整个项目的逻辑和实现方式。通过这些源码,用户可以学习到ASP的基本语法、服务器端脚本编写方法、数据库操作、用户权限管理等关键技术。 数据库设计文件:为了方便用户更好地理解系统的后台逻辑,每个项目中都附带了完整的数据库设计文件。这些文件通常包括数据库结构图、数据表设计文档,以及示例数据SQL脚本。用户可以通过这些文件快速搭建项目所需的数据库环境,并了解各个数据表之间的关系和作用。 详细的开发文档:每个资源包都附有详细的开发文档,文档内容包括项目背景介绍、功能模块说明、系统流程图、用户界面设计以及关键代码解析等。这些文档为用户提供了深入的学习材料,使得即便是从零开始的开发者也能逐步掌握项目开发的全过程。 项目演示与使用指南:为帮助用户更好地理解和使用这些ASP项目,每个资源包中都包含项目的演示文件和使用指南。演示文件通常以视频或图文形式展示项目的主要功能和操作流程,使用指南则详细说明了如何配置开发环境、部署项目以及常见问题的解决方法。 毕业设计参考:对于正在准备毕业设计的学生来说,这些资源包是绝佳的参考材料。每个项目不仅功能完善、结构清晰,还符合常见的毕业设计要求和标准。通过这些项目,学生可以学习到如何从零开始构建一个完整的Web系统,并积累丰富的项目经验。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值