android - ListView in SYSTEM_ALERT_WINDOW -


i'am trying create system alert windows contain listview. have problems. can see there items in listview can not read text , nothing happens if click on items. let me add pictures of issue. enter image description here

as see in first picture no items showing when showing layout bounds can see there 2 items in list.

    listview lw = new listview(this);     string[] stringarray = new string[] { "bright mode", "normal mode" };     arrayadapter<string> modeadapter = new arrayadapter<string>(this, android.r.layout.simple_list_item_1, android.r.id.text1, stringarray);     lw.setadapter(modeadapter);     layout.addview(lw); 

this how created list.

edit

i solved visibility issue have still issues clicking on items in list. strange thing works on samsung galaxy note not on other device. click logic.

        listview.setonitemclicklistener(new adapterview.onitemclicklistener() {         @override         public void onitemclick(adapterview<?> parent, view view, int position, long id) {             log.v("head", "click");         }     }); 

i suggest this:

string[] stringarray = new string[] { "bright mode", "normal mode" }; listview.setadapter(new arrayadapter<string>(this, android.r.layout.simple_list_item_1, stringarray ) {     @override     public view getview(int position, view convertview, viewgroup parent) {         textview textview = (textview) super.getview(position, convertview, parent);          string text = stringarray [position];         textview.settextcolor(color.black);         return textview;     } }); 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -