推荐阅读http://chenzheng8975.iteye.com/blog/2061805
product_list_index.xml:
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:umadsdk="http://schemas.android.com/apk/res/com.LoveBus" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@color/white" android:orientation="vertical" > <LinearLayout android:id="@+id/linearLayout1" android:layout_width="fill_parent" android:layout_height="40dp" android:background="#FFFFFF" > <TextView android:id="@+id/text1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1.0" android:gravity="center" android:text="销售" android:textColor="#000000" android:textSize="22.0dip" /> <View android:layout_width="2dip" android:layout_height="30dip" android:layout_gravity="center_vertical" android:background="#D7D7D7" /> <TextView android:id="@+id/text2" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1.0" android:gravity="center" android:text="价格" android:textColor="#000000" android:textSize="22.0dip" /> <View android:layout_width="2dip" android:layout_height="30dip" android:layout_gravity="center_vertical" android:background="#D7D7D7" /> <TextView android:id="@+id/text3" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1.0" android:gravity="center" android:text="新品" android:textColor="#000000" android:textSize="22.0dip" /> <View android:layout_width="2dip" android:layout_height="30dip" android:layout_gravity="center_vertical" android:background="#D7D7D7" /> <TextView android:id="@+id/text4" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1.0" android:gravity="center" android:text="促销" android:textColor="#000000" android:textSize="22.0dip" /> </LinearLayout> <ImageView android:id="@+id/cursor" android:layout_width="fill_parent" android:layout_height="wrap_content" android:scaleType="matrix" android:src="@drawable/line" /> <View android:layout_width="fill_parent" android:layout_height="1dip" android:layout_gravity="center_vertical" android:background="#aaaaaa" /> <!-- 搜索信息 --> <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:gravity="center_vertical" android:orientation="horizontal" > <!-- 搜索按钮 --> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:layout_marginLeft="22dp" android:src="@drawable/product_search" /> <EditText android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginLeft="8dp" android:layout_marginRight="22dp" android:text="关键字" android:textColor="#ACACAC" /> </LinearLayout> <android.support.v4.view.ViewPager android:id="@+id/vPager" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_weight="1.0" android:background="@color/white" android:flipInterval="30" android:persistentDrawingCache="animation" /> </LinearLayout>
product_list_detail.xml:
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@color/white" > <ImageView android:id="@+id/test_flower" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="8dp" /> <LinearLayout android:orientation="vertical" android:layout_width="wrap_content" android:layout_height="wrap_content"> <TextView android:id="@+id/product_title" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textColor="@color/black" android:textSize="18dp" /> <LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content"> <TextView android:id="@+id/now_price" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#fd6600" android:textSize="25dp" /> <TextView android:id="@+id/old_price" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#989898" android:textSize="18dp" /> </LinearLayout> <LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content"> <TextView android:id="@+id/deliery" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical|left" android:textColor="#989898" android:textSize="15dp" /> <TextView android:id="@+id/pay_info" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center_horizontal" android:textColor="#989898" android:textSize="15dp" /> <TextView android:id="@+id/location_info" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical|right" android:textColor="#989898" android:textSize="15dp" /> </LinearLayout> </LinearLayout> <Button android:id="@+id/view_btn" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="确认" android:layout_gravity="bottom|right" /> </LinearLayout>
product_list_view.xml:
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@color/white"> <ListView android:id="@+id/list_view" android:layout_width="fill_parent" android:layout_height="fill_parent" android:divider="#ffc9c9c9" android:dividerHeight="1px" android:layout_marginRight="15dp"/> </LinearLayout>
ProductList.java:
package com.weijie.app_user.activity.product; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import android.app.Activity; import android.content.Context; import android.graphics.BitmapFactory; import android.graphics.Color; import android.graphics.Matrix; import android.os.Bundle; import android.os.Parcelable; import android.support.v4.view.PagerAdapter; import android.support.v4.view.ViewPager; import android.support.v4.view.ViewPager.OnPageChangeListener; import android.util.DisplayMetrics; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.animation.Animation; import android.view.animation.TranslateAnimation; import android.widget.BaseAdapter; import android.widget.Button; import android.widget.ImageView; import android.widget.ListView; import android.widget.TextView; import com.weijie.app_user.R; public class ProductList extends Activity { private List<Map<String, Object>> mData; private ViewPager mPager;//页卡内容 private List<View> listViews; // Tab页面列表 private ImageView cursor;// 动画图片 private TextView t1, t2, t3,t4;// 页卡头标 private int offset = 0;// 动画图片偏移量 private int currIndex = 0;// 当前页卡编号 private int bmpW;// 动画图片宽度 @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); super.setContentView(R.layout.product_list_index); // 默认布局管理器 mData = getData(); InitImageView(); InitTextView(); InitViewPager(); } private List<Map<String, Object>> getData() { List<Map<String, Object>> list = new ArrayList<Map<String, Object>>(); Map<String, Object> map = new HashMap<String, Object>(); map.put("test_flower", R.drawable.test_flower); map.put("product_title", "红玫瑰花束鲜花预定合肥鲜花速递生日鲜花"); map.put("now_price", "¥98.00"); map.put("old_price", "¥188.00"); map.put("deliery", "顺丰"); map.put("pay_info", "2418人已付款"); map.put("location_info", "合肥包河"); list.add(map); map = new HashMap<String, Object>(); map.put("test_flower", R.drawable.test_flower); map.put("product_title", "红玫瑰花束鲜花预定合肥鲜花速递生日鲜花"); map.put("now_price", "¥98.00"); map.put("old_price", "¥188.00"); map.put("deliery", "顺丰"); map.put("pay_info", "2418人已付款"); map.put("location_info", "合肥包河"); list.add(map); map = new HashMap<String, Object>(); map.put("test_flower", R.drawable.test_flower); map.put("product_title", "红玫瑰花束鲜花预定合肥鲜花速递生日鲜花"); map.put("now_price", "¥98.00"); map.put("old_price", "¥188.00"); map.put("deliery", "顺丰"); map.put("pay_info", "2418人已付款"); map.put("location_info", "合肥包河"); list.add(map); return list; } /** * 初始化头标 */ private void InitTextView() { t1 = (TextView) findViewById(R.id.text1); t2 = (TextView) findViewById(R.id.text2); t3 = (TextView) findViewById(R.id.text3); t4 = (TextView) findViewById(R.id.text4); t1.setOnClickListener(new MyOnClickListener(0)); t2.setOnClickListener(new MyOnClickListener(1)); t3.setOnClickListener(new MyOnClickListener(2)); t4.setOnClickListener(new MyOnClickListener(3)); } /** * 初始化动画 */ private void InitImageView() { cursor = (ImageView) findViewById(R.id.cursor); bmpW = BitmapFactory.decodeResource(getResources(), R.drawable.line) .getWidth();// 获取图片宽度 DisplayMetrics dm = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(dm); int screenW = dm.widthPixels;// 获取分辨率宽度 offset = (screenW / 4 - bmpW) / 2;// 计算偏移量 Matrix matrix = new Matrix(); matrix.postTranslate(offset, 0); cursor.setImageMatrix(matrix);// 设置动画初始位置 } /** * 初始化ViewPager */ private void InitViewPager() { mPager = (ViewPager) findViewById(R.id.vPager); listViews = new ArrayList<View>(); LayoutInflater inflater = getLayoutInflater(); View view1 = inflater.inflate(R.layout.product_list_view, null); ListView mListView1 =(ListView) view1.findViewById(R.id.list_view); mListView1.setAdapter(new MyAdapter(this)); View view2 = inflater.inflate(R.layout.product_list_view, null); ListView mListView2 =(ListView) view2.findViewById(R.id.list_view); mListView2.setAdapter(new MyAdapter(this)); View view3 = inflater.inflate(R.layout.product_list_view, null); ListView mListView3 =(ListView) view3.findViewById(R.id.list_view); mListView3.setAdapter(new MyAdapter(this)); View view4 = inflater.inflate(R.layout.product_list_view, null); ListView mListView4 =(ListView) view4.findViewById(R.id.list_view); mListView4.setAdapter(new MyAdapter(this)); listViews.add(mListView1); listViews.add(mListView2); listViews.add(mListView3); listViews.add(mListView4); mPager.setAdapter(new MyPagerAdapter(listViews)); mPager.setOffscreenPageLimit(5); mPager.setCurrentItem(0); mPager.setOnPageChangeListener(new MyOnPageChangeListener()); } /** * ViewPager适配器 */ public class MyPagerAdapter extends PagerAdapter { public List<View> mListViews; public MyPagerAdapter(List<View> mListViews) { this.mListViews = mListViews; } @Override public void destroyItem(View arg0, int arg1, Object arg2) { ((ViewPager) arg0).removeView(mListViews.get(arg1)); } @Override public void finishUpdate(View arg0) { } @Override public int getCount() { return mListViews.size(); } @Override public Object instantiateItem(View arg0, int arg1) { ((ViewPager) arg0).addView(mListViews.get(arg1), 0); return mListViews.get(arg1); } @Override public boolean isViewFromObject(View arg0, Object arg1) { return arg0 == (arg1); } @Override public void restoreState(Parcelable arg0, ClassLoader arg1) { } @Override public Parcelable saveState() { return null; } @Override public void startUpdate(View arg0) { } } /** * 头标点击监听 */ public class MyOnClickListener implements View.OnClickListener { private int index = 0; public MyOnClickListener(int i) { index = i; } @Override public void onClick(View v) { mPager.setCurrentItem(index); } }; /** * 页卡切换监听 */ public class MyOnPageChangeListener implements OnPageChangeListener { int one = offset * 2 + bmpW;// 页卡1 -> 页卡2 偏移量 int two = one * 2;// 页卡1 -> 页卡3 偏移量 int three = one * 3; @Override public void onPageSelected(int arg0) { Animation animation = null; switch (arg0) { case 0: if (currIndex == 1) { animation = new TranslateAnimation(one, 0, 0, 0); } else if (currIndex == 2) { animation = new TranslateAnimation(two, 0, 0, 0); }else if (currIndex == 3) { animation = new TranslateAnimation(three, 0, 0, 0); } break; case 1: if (currIndex == 0) { animation = new TranslateAnimation(offset, one, 0, 0); } else if (currIndex == 2) { animation = new TranslateAnimation(two, one, 0, 0); }else if (currIndex == 3) { animation = new TranslateAnimation(three, one, 0, 0); } break; case 2: if (currIndex == 0) { animation = new TranslateAnimation(offset, two, 0, 0); } else if (currIndex == 1) { animation = new TranslateAnimation(one, two, 0, 0); } else if (currIndex == 3) { animation = new TranslateAnimation(three, two, 0, 0); } break; case 3: if (currIndex == 0) { animation = new TranslateAnimation(offset, three, 0, 0); } else if (currIndex == 1) { animation = new TranslateAnimation(one, three, 0, 0); } else if (currIndex == 2) { animation = new TranslateAnimation(two, three, 0, 0); } break; } currIndex = arg0; animation.setFillAfter(true);// True:图片停在动画结束位置 animation.setDuration(300); cursor.startAnimation(animation); } @Override public void onPageScrolled(int arg0, float arg1, int arg2) { } @Override public void onPageScrollStateChanged(int arg0) { } } public final class ViewHolder{ public ImageView test_flower; public TextView product_title; public TextView now_price; public TextView old_price; public TextView deliery; public TextView pay_info; public TextView location_info; } public class MyAdapter extends BaseAdapter{ private LayoutInflater mInflater; public MyAdapter(Context context){ this.mInflater = LayoutInflater.from(context); } @Override public int getCount() { // TODO Auto-generated method stub return mData.size(); } @Override public Object getItem(int arg0) { // TODO Auto-generated method stub return null; } @Override public long getItemId(int arg0) { // TODO Auto-generated method stub return 0; } @Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder = null; if (convertView == null) { holder=new ViewHolder(); convertView = mInflater.inflate(R.layout.product_list_detail, null); holder.product_title = (TextView)convertView.findViewById(R.id.product_title); holder.test_flower = (ImageView)convertView.findViewById(R.id.test_flower); holder.now_price = (TextView)convertView.findViewById(R.id.now_price); holder.old_price = (TextView)convertView.findViewById(R.id.old_price); holder.deliery = (TextView)convertView.findViewById(R.id.deliery); holder.pay_info = (TextView)convertView.findViewById(R.id.pay_info); holder.location_info = (TextView)convertView.findViewById(R.id.location_info); convertView.setTag(holder); }else { holder = (ViewHolder)convertView.getTag(); } holder.test_flower.setBackgroundResource((Integer)mData.get(position).get("test_flower")); holder.product_title.setText((String)mData.get(position).get("product_title")); holder.now_price.setText((String)mData.get(position).get("now_price")); holder.old_price.setText((String)mData.get(position).get("old_price")); holder.deliery.setText((String)mData.get(position).get("deliery")); holder.pay_info.setText((String)mData.get(position).get("pay_info")); holder.location_info.setText((String)mData.get(position).get("location_info")); return convertView; } } }
相关推荐
"基于PID搜索优化算法的FMD分解优化研究与应用","基于PSA与PID搜索优化算法的FMD分解创新方法:一种2023年SCI顶刊实践的智能优化技术",【优化fmd分解】PSA–fmd分解,PID搜索优化算法(PID-based search algorithm, PSA,2023年12月发表在SCI人工智能一区顶刊《Expert Systems With Applications》,利用该算法优化fmd分解,做为一种创新点使用。 具体如下图 ,优化fmd分解; PSAfmd分解; PID搜索优化算法; 创新点,基于PSA算法的FMD分解优化研究
内容概要:本文档详细介绍了DBC文件的格式及其组成部分,用于描述CAN通讯网络。主要内容涵盖版本和新规范符号、位定时、节点、数值表、报文和信号的定义、环境变量、注释以及用户属性等方面。通过对各部分的解析,可以帮助开发者更好地理解和配置CAN网络的通讯参数。文档还包括具体的实例,帮助理解实际应用场景。 适合人群:主要适用于从事汽车电子控制系统开发的技术人员,尤其是负责车载网络通信的设计和实施的工程师。 使用场景及目标:帮助工程师解析和创建CAN网络的DBC文件,确保正确配置和优化CAN总线通信,提高系统的可靠性和效率。通过DBC文件进行网络节点定义、信号传输设置等任务,有助于加速产品的开发周期并减少错误配置的风险。 其他说明:虽然DBC文件主要用于描述CAN通讯,但它不能直接定义环境变量或进行系统仿真。此外,某些部分(如过滤器和支持旧标准的部分)已废弃但仍需保留在文件中以维持兼容性。
"2024视酷酷信IM即时通讯源码:全4端互通,安全稳定,支持二次开发及多端部署","2024视酷酷信IM即时通讯源码:全4端互通,安全可靠,可二次开发,适用于技术达人的专业级即时通讯系统",2024亲测可用视酷酷信即时通讯,IM即时通讯源码 全4端互通通讯带教程源码 完整版,可以搭建成功 1.适合有技术能力的 2.源码支持二次开发和修改,可以二开加商城等 3.源码没有任何后门,安全部署到自己的服务器上,无需担心数据丢失,隐私有保障 4.4端互通,使用国产最新tio通信技术,tigase都是老版的 软件部署环境: 1.客户端:安卓,苹果,pc端、web端 2.开发语言: Java、 OC、 C#、vue 3.运行软件:idea Java xcode android studio、Visual Studio 4.数据库:mongodb (可大量存储数据) 5.环境:linux系统centos7.6 6.系统优势:单台服务器可承载万人并发同时在线;需求大的话可做集群,性能非常强大 ,2024年; 视酷酷信即时通讯; IM源码; 全4端互通通讯; 源码二开; 安全部署; TIO通信技
雨天前车窗雨滴等障碍物图像分割系统:新手课程精选
"Aspen Plus模拟下的生物质化学链工艺:氢气与氨气的绿色生产模型","Aspen Plus模拟:生物质化学链工艺生产氢气和氨气的清洁化过程",Aspen Plus化工过程模拟化学链工艺从生物质中生产氢气和氨气 本模型复现了Journal of Cleaner Production中一篇文章的模型。 在本模型中,首先将生物质通过化学链工艺转化为氢气,之后使用哈伯法将氢气转化为氨气。 ,Aspen Plus; 化工过程模拟; 化学链工艺; 生物质; 氢气生产; 氨气生产; Journal of Cleaner Production; 哈伯法。,"Aspen Plus模拟化学链工艺产氢氨从生物质出发"
"光伏混合储能系统中的VSG技术:实现光储一次调频、功率平抑及直流母线电压控制的高效策略",光伏混合储能VSG系统:实现光储一次调频、功率平抑及直流母线电压控制的多功能应用,光伏混合储能VSG一一光储一次调频、功率平抑、 直流母线电压控制。 ,核心关键词:光伏混合储能; VSG; 光储一次调频; 功率平抑; 直流母线电压控制;,"光伏混合储能系统中的VSG技术与调频、功率平抑及电压控制"
chat-api.yaml.bak
前端分析-2023071100789
新建 Microsoft Excel 工作表.xlsx
c 使用 C#,开发一个气溶胶光学厚度反演算法的窗体应用程序 使用 C#,开发一个气溶胶光学厚度反演算法的窗体应用程序
本文全面介绍了Go语言的学习资源,包括官方文档、在线教程、书籍推荐、开源项目、工具框架、社区论坛、实战项目、进阶资源以及视频教程和博客文章等多个方面。通过官方文档、Go Tour、书籍如《The Go Programming Language》等优质资料可以帮助读者系统地学习Go语言。开源项目如Docker、Kubernetes展示了Go语言的实际应用;Go Modules等工具提供了便捷的支持;而实战项目能提高动手能力。博客文章则分享了前沿技术见解,视频教程适合视听学习者。
"基于StarCCM+的储能液冷系统热管理仿真教学视频:带热失控仿真计算,三个模型文件实战练习","基于StarCCM+的储能液冷系统热管理仿真教学视频:带热失控仿真计算与三个模型文件供练习的实践指南",储能热管理 基于starccm+ 储能液冷系统热管理仿真 带热失控仿真计算…… 教学视屏,三个模型文件供练习。 储能热管理 ,核心关键词:储能热管理;starccm+仿真;液冷系统热管理;热失控仿真计算;教学视屏;模型文件练习。,《基于Starccm+的储能液冷系统与热失控仿真教学视频》
【毕业设计】IoT安全漏洞检测平台(中国民航大学本科毕业设计)
显示湿度 51单片机代码 大学生嵌入式
【毕业设计】校园二手商品交易平台,ssm框架+layui_pgj
c 一个基于C#的STK二次开发 一个基于C#的STK二次开发
2024免费毕业设计成品,包括源码+数据库+往届论文资料,附带启动教程和安装包。 启动教程:https://www.bilibili.com/video/BV1jKDjYrEz1 技术栈:Vue.js+SpringBoot+MySQL。 开发工具:Idea+VSCode。
"基于随机森林算法的RF多变量时间序列预测外部工具箱:Matlab代码与Windows 64位系统兼容版",基于随机森林算法的RF多变量时间序列预测工具箱:Matlab代码与外部工具集成解决方案,基于随机森林(RF)算法的多变量时间序列预测 外部工具箱 RF多变量时间序列 matlab代码 注:暂无Matlab版本要求 -- 推荐 2018B 版本及以上 注:采用 RF 工具箱(无需安装,可直接运行),仅支持 Windows 64位系统 ,基于随机森林(RF)算法; 多变量时间序列预测; 外部工具箱; RF多变量时间序列预测的Matlab代码; Windows 64位系统。,"基于随机森林算法的Windows多变量时间序列预测外部工具箱"