Android 快速实现一个文件选择器
2010-02-24 04:48:00 来源:WEB开发网}
public View getView(int arg0, View arg1, ViewGroup arg2) {
// TODO Auto-generated method stub
//LinearLayout layout=null ;
LayoutInflater inflate = (LayoutInflater) mContext.getSystemService(android.content.Context.LAYOUT_INFLATER_SERVICE);
arg1 = (LinearLayout) inflate.inflate(R.layout.listfile,null);
TextView fm_text_01= (TextView)arg1.findViewById(R.id.fm_text_01);
fm_text_01.setText(getItem(arg0).name);
//Log.v("vodone",""+arg0+" name="+getItem(arg0).name);
/*if (getItem(arg0).equals(".")){
}*/
return arg1 ;
}
}
private class ExpBaseAdapter extends BaseAdapter {
private Context mContext;
private Vector mItems = new Vector();
private LinearLayout layout,layout_more;
public ExpBaseAdapter(Context context) {
mContext = context;
}
public void addItem(fileData it) {
mItems.add(it);
}
public fileData getItem(int it) {
return (fileData)mItems.elementAt(it);
}
public int getCount() {
// TODO Auto-generated method stub
return mItems.size();
}
public long getItemId(int arg0) {
// TODO Auto-generated method stub
return arg0;
}
public int getItemType(int arg0) {
// TODO Auto-generated method stub
return getItem(arg0).type;
}
public void clearItems(){
mItems.clear();
}
public View getView(int arg0, View arg1, ViewGroup arg2) {
// TODO Auto-generated method stub
//LinearLayout layout=null ;
LayoutInflater inflate = (LayoutInflater) mContext.getSystemService(android.content.Context.LAYOUT_INFLATER_SERVICE);
arg1 = (LinearLayout) inflate.inflate(R.layout.listfile,null);
更多精彩
赞助商链接