Picture and text mixed row

Source: Internet
Author: User

Package Com.wt.ada;

Import java.util.ArrayList;

Import Com.lidroid.xutils.BitmapUtils;
Import COM.WT.TOP.R;
Import Com.wt.vo.Data;

Import Android.content.Context;
Import android.opengl.Visibility;
Import android.support.v4.app.FragmentActivity;
Import Android.view.View;
Import Android.view.ViewGroup;
Import Android.widget.BaseAdapter;
Import Android.widget.ImageView;
Import Android.widget.TextView;

public class Fraglvadapter extends baseadapter{

Private Context con;
Private arraylist<data> Data;
Private ViewHolder1 VH1;
Private ViewHolder2 VH2;
Private Bitmaputils bu;


Public Fraglvadapter (Context con, arraylist<data> Data) {
TODO auto-generated Constructor stub
This.con=con;
This.data=data;
Bu = new bitmaputils (con);


}

@Override
public int GetCount () {
TODO auto-generated Method Stub
return Data.size ();
}

@Override
Public Object getItem (int position) {
TODO auto-generated Method Stub
return null;
}

@Override
public long getitemid (int position) {
TODO auto-generated Method Stub
return 0;
}

@SuppressWarnings ("unused")
@Override
Public View GetView (int position, View Convertview, ViewGroup parent) {
TODO auto-generated Method Stub
int size=0;
if (Data.get (position). Getimage_list ()!=null) {
Size = Data.get (position). Getimage_list (). Size ();
}

switch (size) {
Case 0:
if (Data.get (position). Getmiddle_image ()!=null) {

Convertview=view.inflate (con,r.layout.frag_lv_item1, NULL);
VH1 = new ViewHolder1 ();
Vh1.title= (TextView) Convertview.findviewbyid (r.id.title);
vh1.image1= (ImageView) Convertview.findviewbyid (r.id.image1);
Convertview.settag (VH1);
Vh1.title.setText (Data.get (position). GetTitle ());
Vh1.title.setWidth (220);
Bu.display (Vh1.image1, data.get (position). Getmiddle_image (). GETURL ());
}else {
Convertview=view.inflate (con,r.layout.frag_lv_item1, NULL);
VH1 = new ViewHolder1 ();
Vh1.title= (TextView) Convertview.findviewbyid (r.id.title);
vh1.image1= (ImageView) Convertview.findviewbyid (r.id.image1);
Convertview.settag (VH1);
Vh1.title.setText (Data.get (position). GetTitle ());

Vh1.image1.setVisibility (View.gone);
}

Break

Case 3:
Convertview = null;
if (convertview==null) {

Convertview=view.inflate (con,r.layout.frag_lv_item3, NULL);
VH2 = new ViewHolder2 ();
vh2.title3= (TextView) Convertview.findviewbyid (R.ID.TITLE3);
vh2.image3_1= (ImageView) Convertview.findviewbyid (r.id.image3_1);
Vh2.image3_2= (ImageView) Convertview.findviewbyid (r.id.image3_2);
vh2.image3_3= (ImageView) Convertview.findviewbyid (r.id.image3_3);
Convertview.settag (VH2);
Vh2.title3.setText (Data.get (position). GetTitle ());
Bu.display (Vh2.image3_1, data.get (position). Getimage_list (). Get (0). GETURL ());
Bu.display (Vh2.image3_2, data.get (position). Getimage_list (). Get (1). GETURL ());
Bu.display (Vh2.image3_3, data.get (position). Getimage_list (). Get (2). GETURL ());

}
Break
}
return convertview;
}
Class viewholder1{
TextView title;
ImageView Image1;
}
Class viewholder2{
TextView Title3;
ImageView Image3_1;
ImageView Image3_2;
ImageView Image3_3;
}
}

Picture and text mixed row

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.