Android Project Complex ListView

Source: Internet
Author: User

    Private classAppadapterextendsBaseadapter {@Override Public intGetCount () {//TODO auto-generated Method Stub            returnUserapp.size () +sysapp.size () +2; } @Override PublicObject GetItem (intarg0) {            //TODO auto-generated Method Stub            returnarg0; } @Override Public LongGetitemid (intarg0) {            //TODO auto-generated Method Stub            returnarg0; } @Override PublicView GetView (intposition, View arg1, ViewGroup arg2)            {AppInfo app; //determine if the current position is the first, if it is returned to a TextView            if(position==0) {TextView TV=NewTextView (appmanageractivity. This); Tv.settext ("User Program (" +userapp.size () + ")");                Tv.settextcolor (Color.White); returnTV; //determines whether the current position is used to display the next TextView location, which is the user program collection +1}Else if(Position==userapp.size () +1) {TextView TV=NewTextView (appmanageractivity. This); Tv.settext ("System Program (" +sysapp.size () + ")");                Tv.settextcolor (Color.White); returnTV; //determine location is not used to display the user program location}Else if(position<=userapp.size ()) {App= Userapp.get (position-1); //and finally the location to show the system program.}Else{app= Sysapp.get (Position-userapp.size ()-2); } View v=NULL; Viewholder Viewholder=NULL; //for validation, the cache must be a subclass of LinearLayout,            if(Arg1! =NULL&&arg1instanceoflinearlayout) {v=arg1; Viewholder=(Viewholder) V.gettag (); } Else{v= View.inflate (appmanageractivity. This, R.layout.item_app_show,NULL); Viewholder=NewViewholder (); Viewholder.tv_name=(TextView) v. Findviewbyid (r.id.app_item_tv_name); Viewholder.tv_location=(TextView) v. Findviewbyid (r.id.app_item_tv_location); Viewholder.img_icon=(ImageView) v. Findviewbyid (R.ID.APP_ITEM_IMG_ICON); //Consistent CorrespondenceV.settag (Viewholder);            } viewHolder.img_icon.setImageDrawable (App.geticon ());            ViewHolder.tv_name.setText (App.getname ()); if(App.isrow ()) {ViewHolder.tv_location.setText ("Internal Storage Program"); } Else{ViewHolder.tv_location.setText ("External Storage Program"); }            returnv; }    }    Static classViewholder {ImageView img_icon;        TextView Tv_name;    TextView tv_location; }

Android Project Complex ListView

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.