Tuesday, 15 April 2014

java - Android ListView fonts -



java - Android ListView fonts -

i need alter size , color of items in listview. listview within linearlayout, , when open listview opens in top of layout want shows in bottom right. in advice.

public void onclick(view v) {

displaymetrics metrics = new displaymetrics(); ((activity) mcontext).getwindowmanager().getdefaultdisplay().getmetrics(metrics); int h = metrics.heightpixels; int w = metrics.widthpixels; int[] loc_int = new int[2]; v.getlocationonscreen(loc_int); rect location = new rect(); location.left = loc_int[0]; location.top = loc_int[1]; location.right = location.left + v.getwidth(); location.bottom = location.top + v.getheight(); layoutinflater inflater = (layoutinflater) mcontext.getsystemservice(context.layout_inflater_service); view layout = inflater.inflate(r.layout.popup_libro_lista,(viewgroup) grid.findviewbyid(r.id.popup_element)); listview listview = (listview) layout.findviewbyid(r.id.listpopup); final arrayadapter<string> adaptador = new arrayadapter<string>(mcontext, `android.r.layout.simple_spinner_item`, listalibrostoaccess.get(newpos).menupopup); listview.setadapter(adaptador); listview.setonitemclicklistener(new adapterview.onitemclicklistener(){ @override public void onitemclick(adapterview<?> parent, view view, int position, long id){ log.d("este adapter conduce a: ", adaptador.getitem(position).tostring()); } }); pwindo2 = new popupwindow(layout, h, w, true); pwindo2.showatlocation(layout, gravity.center, 0, 0); } });

try setting parent relativelayout (with height , width fill_parent), instead of linearlayout. after that, set these properties listview:

android:align_parentbottom="true" android:align_parentright="true"

i hope helps!!

java android xml listview

No comments:

Post a Comment