Android similar to QQ account landing dropdown box effect implementation (with source)

Source: Internet
Author: User


    • Part of the source

//settings for PopupwindowDownarroimageview.setonclicklistener (NewOnclicklistener () {@Override             Public void OnClick(View arg0) {//Definition PopupwindowPopupwindow =NewPopupwindow (mainactivity. This);//Set widthPopupwindow.setwidth (Inputedittext.getwidth ());//Set the height of the PopupwindowPopupwindow.setheight ( $);//Fill in content for PopupwindowPopupwindow.setcontentview (ListView);//Click outside the Popupwindow to automatically turn off PopupwindowPopupwindow.setoutsidetouchable (true);//Set pop-up window, display the locationPopupwindow.showasdropdown (Inputedittext,0,0); }        });
// 初始化listviewprivatevoidinitListView() {        // TODO 自动生成的方法存根        new ListView(this);        // 设置背景色        listView.setBackgroundResource(R.drawable.listview_background);        // 分隔线设置为null        listView.setDivider(null);        // 设置滚动条为false        listView.setVerticalScrollBarEnabled(false);        listView.setAdapter(new MyListAdapter());    }
//MylistadapterPrivate  class mylistadapter extends baseadapter {        @Override         Public int GetCount() {//TODO auto-generated method stub            returnMsglist.size (); }@Override         PublicObjectGetItem(intARG0) {//TODO auto-generated method stub            return NULL; }@Override         Public Long Getitemid(intARG0) {//TODO auto-generated method stub            return 0; }@Override         PublicViewGetView(Final intarg0, View arg1, ViewGroup arg2) {//TODO auto-generated method stubViewholder Houder;if(Arg1 = =NULL) {arg1 = View.inflate (Getapplicationcontext (), R.layout.list_item,NULL); Houder =NewViewholder ();                Houder.deleteimageview = (ImageView) Arg1.findviewbyid (r.id.delete);                Houder.tv_msgtextview = (TextView) Arg1.findviewbyid (R.id.tv_list_item);            Arg1.settag (Houder); }Else{Houder = (Viewholder) arg1.gettag ();            } houder.tv_msgTextView.setText (Msglist.get (arg0)); Houder.deleteImageView.setOnClickListener (NewOnclicklistener () {@Override                 Public void OnClick(View v) {//delete the corresponding entryMsglist.remove (arg0);//Refresh ListViewMylistadapter. This. notifydatasetchanged ();            }            }); Arg1.setonclicklistener (NewOnclicklistener () {@Override                 Public void OnClick(View v) {//Set Input boxInputedittext.settext (Msglist.get (arg0));//Hide PopupwindowPopupwindow.dismiss (); }            });returnArg1; }    }Private  class viewholder {TextView Tv_msgtextview;    ImageView Deleteimageview; }

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Android similar to QQ account landing dropdown box effect implementation (with source)

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.