RelativeLayout : android:layout_height has no effect -
for reason android:layout_height="200sp"
attribute not have effect. preview gets drawn correctly in android studio if run app list items not changing size according android:layout_height="200sp"
. using relativelayout
list item listview
.
any suggestions?
<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="120dip" android:background="#ffffff" > <imageview android:id="@+id/icon" android:src="@drawable/ic_launcher" android:layout_width="50dip" android:layout_height="50dip" android:layout_alignparentbottom="true" android:layout_alignparenttop="true" android:layout_gravity="center" /> </relativelayout>
@edit:
i've made simpler example. assume list items 120dip
in height , got icon on left side 50x50 dip
in size. reality list items have same height imageview
reason.
public view getview(int position, view convertview, viewgroup parent) { // todo auto-generated method stub viewholder holder; if(convertview == null){ convertview = minflater.inflate(r.layout.listview_nearbylist_item, null); holder = new viewholder(); //holder.text1 = (textview) convertview.findviewbyid(r.id.text1); //holder.text2 = (textview) convertview.findviewbyid(r.id.text2); //holder.text3 = (textview) convertview.findviewbyid(r.id.text3); convertview.settag(holder); } else { holder = (viewholder) convertview.gettag(); } //holder.text1.settext(items.get(position).getrestaurantname()); //holder.text2.settext(items.get(position).getrestaurantgenre()); //holder.text3.settext("08:00 - 18:00 uhr"); return convertview; }
convertview = minflater.inflate(r.layout.listview_nearbylist_item, null);
you have 2 problems here:
i don't know
minflater
comes from, pleasegetlayoutinflater()
called on activity, not other source. otherwise, themes won't work.use
inflate(r.layout.listview_nearbylist_item, parent, false)
, may fix height problem, , if nothing else avoid other problems rows based onrelativelayout
.
Comments
Post a Comment