For some reason the android:layout_height="200sp"
attribute does not have any effect. The preview gets drawn correctly in Android Studio but if I run my App the list items are not changing their size according to android:layout_height="200sp"
. I am using this RelativeLayout
as a list item for a 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 a simpler example. I would assume that the list items would be 120dip
in height and got an icon on their left side with 50x50 dip
in size. The reality is that the list items have the same height as the ImageView
for some 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;
}