I had a similar problem, I think I decided to report it this way.
I have more rows in my ListView, but I want the row height to be the same in the list, which in turn will take up the rest of the layout space. My line consists of only one ImageView. I had problems with the following:
-I want smaller images to expand to take up all the space -Byr images should not exceed the line height
If I made any mistake, leave a note here.
<LinearLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="0.9" android:gravity="center" android:orientation="vertical"> <ListView android:id="@id/lay_main_firma_objekti" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center"> </ListView> </LinearLayout>
Line layout:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center"> <TextView android:id="@+id/xx" android:layout_width="match_parent" android:layout_height="match_parent"/> <ImageView android:id="@id/imageView_obj" android:contentDescription="@string/objektDesc" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_alignLeft="@id/xx" android:layout_alignTop="@id/xx" android:layout_alignRight="@id/xx" android:layout_alignBottom="@id/xx" android:scaleType="fitXY" android:src="@drawable/custom_prazno" /> </RelativeLayout>
Then in the getView adapter itβs important
convertView.setMinimumHeight(parent.getMeasuredHeight()); ImageView slika=(ImageView)v.findViewById(R.id.imageView_obj); slika.setMinimumHeight(parent.getMeasuredHeight()); TextView xx=(TextView)v.findViewById(R.id.xx); xx.setHeight(parent.getMeasuredHeight());
I think it has. Hth
source share