源码简介:仿的一个华为商城的项目,还有些功能没有实现,就是几个页面,登录功能和支付没有写,用了fragment,listview,gridview,异步请求。写的时候没有用任何第三方类库,HttpClient,数据库存储,内部缓存和外部缓存都是自己写的。有不完善的地方大家多多海涵。大家相互学习~
源码效果:
源码片段:
- package com.parfois.adapter;
- import java.util.List;
- import com.parfois.bean.Category;
- import com.parfois.vmall.R;
- import android.content.Context;
- import android.view.View;
- import android.view.ViewGroup;
- import android.widget.BaseAdapter;
- import android.widget.TextView;
- public class CategoryLeftAdapter extends BaseAdapter {
- private Context context;
- private List<category> list;
- private TextView list_category_left_tvname;
- public CategoryLeftAdapter(Context context, List<category> list) {
- this.context = context;
- this.list = list;
- }
- public int getCount() {
- return list.size();
- }
- @Override
- public Object getItem(int position) {
- return list.get(position);
- }
- @Override
- public long getItemId(int position) {
- return position;
- }
- @Override
- public View getView(int position, View convertView, ViewGroup parent) {
- if(convertView==null){
- convertView=View.inflate(context, R.layout.listview_categoryleft_item, null);
- list_category_left_tvname=(TextView) convertView.findViewById(R.id.list_category_left_tvname);
- convertView.setTag(list_category_left_tvname);
- }else{
- list_category_left_tvname=(TextView) convertView.getTag();
- }
- list_category_left_tvname.setText(list.get(position).getName());
- if(position==0){
- convertView.setBackgroundResource(R.drawable.left_arrow_onclick);
- }
- return convertView;
- }
- }
- </category></category>