listAdapter

android:screenOrientation="landscape"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:configChanges="orientation|keyboardHidden"

android:theme="@android:style/Theme.NoTitleBar.Fullscreen"

package Pbi.PbiMC.utils;

import java.util.List;

import Pbi.PbiMC.R;
import Pbi.PbiMC.bean.VideoBean;
import android.content.Context;
import android.util.Log;
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 ListAdapter extends BaseAdapter {

private class GridHolder {
ImageView appImage;
TextView appName;
}

private Context context;

private List<VideoBean> items;
private LayoutInflater mInflater;

public ListAdapter(Context c) {
super();
this.context = c;
}

public void setList(List<VideoBean> items) {
if (null==this.items) {
this.items = items;
}
mInflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}

public int getCount() {
return items.size();
}

@Override
public Object getItem(int index) {

return items.get(index);
}

@Override
public long getItemId(int index) {
return index;
}

@Override
public View getView(int index, View convertView, ViewGroup parent) {
GridHolder holder;
if (convertView == null) {  
convertView = mInflater.inflate(R.layout.item_row, null);  
holder = new GridHolder();
holder.appName = (TextView)convertView.findViewById(R.id.item_list_text);
holder.appImage = (ImageView) convertView.findViewById(R.id.item_list_icon);
convertView.setTag(holder);  

}else{
holder = (GridHolder) convertView.getTag();  
}
VideoBean info = (VideoBean) items.get(index);
if (info != null) {
Log.e("PbiMC", "  img  : " + info.get_img());
if (null!=info.get_img()) {
holder.appImage.setImageBitmap(info.get_img());
}
holder.appName.setText(info.get_name());
}
return convertView;
}
}




lists = (ListView) this.findViewById(R.id.itemListView);
adapter = new ListAdapter(this);
adapter.setList(db.selectDirectSeed());
lists.setAdapter(adapter);


<?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">

<ImageView android:id="@+id/item_list_icon"
android:layout_width="50dip" android:layout_height="50dip"
android:src="@drawable/item_img" />

<TextView android:id="@+id/item_list_text" android:gravity="center_vertical"
android:layout_width="wrap_content" android:layout_height="43px"
android:layout_marginLeft="15px" android:textSize="30px"
android:layout_marginTop="16px" android:textColor="@drawable/white"
android:layout_marginBottom="16px" />
</LinearLayout>


new AlertDialog.Builder(PbiP2SProject.this)
        .setTitle(R.string.Message)
       
        .setMessage(R.string.ExitMsg)
       
        .setPositiveButton(R.string.ok,
new DialogInterface.OnClickListener() {

public void onClick(DialogInterface dialog, int i) {
                    finish();
// TODO Auto-generated method stub

}
})
.setNegativeButton( R.string.cancel ,
        new DialogInterface.OnClickListener()
                    {
           
            public void onClick(DialogInterface dialog, int i)
            {
           }
            })
.show();

你可能感兴趣的:(list)