zoukankan      html  css  js  c++  java
  • ssss

    package com.bwie.adapter;

    import java.util.List;

    import com.bwie.test.R;
    import com.bwie.vo.Data;
    import com.lidroid.xutils.BitmapUtils;

    import android.content.Context;
    import android.view.LayoutInflater;
    import android.view.View;
    import android.view.ViewGroup;
    import android.widget.BaseAdapter;
    import android.widget.ImageView;
    import android.widget.TextView;

    public class MyAdapter extends BaseAdapter {
        private Context context;
        private List<Data> list;
        public MyAdapter(Context context, List<Data> list) {
            super();
            this.context = context;
            this.list = list;
        }

        @Override
        public int getCount() {
            // TODO Auto-generated method stub
            return list.size();
        }

        @Override
        public Object getItem(int position) {
            // TODO Auto-generated method stub
            return list.get(position);
        }

        @Override
        public long getItemId(int position) {
            // TODO Auto-generated method stub
            return position;
        }

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            // TODO Auto-generated method stub
            ViewHodler vh;
            String imageurl = list.get(position).getIMAGEURL();
            if(imageurl==null){
                    vh = new ViewHodler();
                    convertView = LayoutInflater.from(context).inflate(R.layout.listview_item, null);
                    vh.title1 = (TextView) convertView.findViewById(R.id.title1);
                    vh.fromname1 = (TextView) convertView.findViewById(R.id.fromname1);
                    vh.time1 = (TextView) convertView.findViewById(R.id.time1);
                    vh.title1.setText(list.get(position).getTITLE());
                    vh.fromname1.setText(list.get(position).getFROMNAME());
                    vh.time1.setText(list.get(position).getSHOWTIME());
            }else{
                    vh = new ViewHodler();
                    convertView = LayoutInflater.from(context).inflate(R.layout.listview_item1, null);
                    vh.title2 = (TextView) convertView.findViewById(R.id.title2);
                    vh.fromname2 = (TextView) convertView.findViewById(R.id.fromname2);
                    vh.time2 = (TextView) convertView.findViewById(R.id.time2);
                    vh.image = (ImageView) convertView.findViewById(R.id.imageView);
                
                    vh.title2.setText(list.get(position).getTITLE());
                    vh.fromname2.setText(list.get(position).getFROMNAME());
                    vh.time2.setText(list.get(position).getSHOWTIME());
                    BitmapUtils utils = new BitmapUtils(context);
                    utils.display(vh.image, list.get(position).getIMAGEURL());
                
                
            }
            return convertView;
        }
        class ViewHodler{
            TextView title1,title2,fromname1,fromname2,time1,time2;
            ImageView image;
        }
    }

  • 相关阅读:
    Yocto开发笔记之《Tip-bitbake常用命令》(QQ交流群:519230208)
    Yocto开发笔记之《Tip-设置程序开机启动》(QQ交流群:519230208)
    Yocto开发笔记之《Tip-应用程序无法在目标机运行》(QQ交流群:519230208)
    激光雷达技术
    Yocto开发笔记之《网卡配置》(QQ交流群:519230208)
    Yocto开发笔记之《错误记录》(QQ交流群:519230208)
    Yocto开发笔记之《工具使用:TFTP & NFS & SSH》(QQ交流群:519230208)
    Yocto开发笔记之《U-boot启动内核流程》(QQ交流群:519230208)
    自定义选择提示框
    uitextfield输入字符限制
  • 原文地址:https://www.cnblogs.com/strive-zcg/p/5403322.html
Copyright © 2011-2022 走看看