Popwindow, Popup box, Popwindow Click event Conflict problem very good solution

Source: Internet
Author: User

Try to own Baidu, Mo asked colleagues remember ———— recent sigh, may be too anxious, so later to have the patience to find their own search!!!!

Today is a relatively simple popwindow, pop-up box, this is actually quite simple is mainly a place to compare may be a problem is the Click event

private void Initpopwindow (final TextView Tview) {final string[] name = {"Copy", "Catty", "one", "person", "table", "only", "half", "small", "large", " Two "," half "," pot "," bowl "," pot "," dozen "," bottle "," Cup "," Listen "," jar "," example "," Set "," string "}; View Contentview = Layoutinflater.from (Getactivity ()). Inflate (R.layout.popwindow, NULL); Contentview.setbackgroundcolor (color.white);p Opupwindow = new Popupwindow (Findviewbyid (r.id.fl_layout), 159, 250); Popupwindow.setcontentview (Contentview); TextView TextView = (TextView) Contentview.findviewbyid (R.id.text); Textview.settext ("unit"); ListView ListView = (ListView) Contentview.findviewbyid (R.id.list); arrayadapter<string> adapter = new Arrayadapter<string> (Getactivity (), Android. R.layout.simple_list_item_1, name); Listview.setadapter (adapter);
Popupwindow.setbackgrounddrawable (New paintdrawable ());
<span style= "White-space:pre" ></span>//Get Focus popupwindow.setfocusable (TRUE);
  Click on a layout other than Popwindow to let pop disappear popupwindow.setoutsidetouchable (true);
  is under which layout (control) under (can modify the upper and lower left and right can) Popupwindow.showasdropdown (Tview);
  Monitor Popupwindow missing Popupwindow.setondismisslistener (new Ondismisslistener () {@Overridepublic void Ondismiss () {}}) ; Listview.setonitemclicklistener (New Onitemclicklistener () {@Overridepublic void Onitemclick (adapterview<?> Parent, View view,int position, long id) {mup.setimagedrawable (Getactivity (). Getresources (). Getdrawable ( R.drawable.puj));p Opupwindow.dismiss (); Tview.settext (Name[position]);});

Popwindow, Popup box, Popwindow Click event Conflict problem very good solution

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.