First, write a data adapter of the ListView, pull it out, and write an object to set the object of each Item of the listView. You can use ConvertView to set setTag to include the View house tag. You can use ListvIEW. getChildAt (). getTag. get the object you want, set parameters, or iron code!
GetView:
ItemObj viewHolder = null;
If (convertView = null ){
ViewHolder = new ItemObj ();
ConvertView = mLayoutInflate. inflate (R. layout. simple_item, null );
ViewHolder. mSimpleCardName = (TextView) convertView. findViewById (R. id. simple_name );
ViewHolder. mIsReTake = (TextView) convertView. findViewById (R. id. simple_num );
ViewHolder. mContentNext = (TextView) convertView. findViewById (R. id. status );
ViewHolder. mIsNext = (TextView) convertView. findViewById (R. id. icon_next );
ConvertView. setTag (viewHolder );
} Else {
ViewHolder = (ItemObj) convertView. getTag ();
}
PhotoList aPotoLists = (PhotoList) getItem (position );
If (aPotoLists! = Null ){
ViewHolder. mSimpleCardName. setText (aPotoLists. photoName );
If (KeyInMapITF. TAKESIMPLE_PIC_TEP! = Null ){
ViewHolder. mIsReTake. setText ("(" + 0 + ")");
If (KeyInMapITF. TAKESIMPLE_PIC_TEP.equals (aPotoLists. photoName )){
ArrayList <PhotoList> aLists = (ArrayList <PhotoList>) GlobalParameter. get (KeyInMapITF. TAKESIMPLE_PIC_TEP );
ViewHolder. mIsReTake. setText ("(" + aLists. size () + ")");
}
}
If (aPotoLists. status. equals ("0 ")){
ViewHolder. mContentNext. setText ("unreviewed ");
ViewHolder. mIsNext. setBackgroundDrawable (mContext. getResources (). getDrawable (R. drawable. task_list_arrows ));
} Else {
ViewHolder. mContentNext. setText ("reviewed ");
ViewHolder. mIsNext. setText ("");
ConvertView. setOnClickListener (null );
}
}
Obj object:
Public class ItemObj extends Object {
Public TextView mSimpleCardName; // name of the document
Public TextView mIsReTake; // 0 is a document photo; 1 is a duplicate photo
Public TextView mContentNext; // unsubmitted and unreviewed
Public TextView mIsNext; // arrow
Public TextView getmSimpleCardName (){
Return mSimpleCardName;
}
Public void setmSimpleCardName (TextView mSimpleCardName ){
This. mSimpleCardName = mSimpleCardName;
}
Public TextView getmIsReTake (){
Return mIsReTake;
}
Public void setmIsReTake (TextView mIsReTake ){
This. mIsReTake = mIsReTake;
}
Public TextView getmContentNext (){
Return mContentNext;
}
Public void setmContentNext (TextView mContentNext ){
This. mContentNext = mContentNext;
}
Public TextView getmIsNext (){
Return mIsNext;
}
Public void setmIsNext (TextView mIsNext ){
This. mIsNext = mIsNext;
}