ImageView scaling type not working in list activity

I have used ImageView before and understand the different types of scales that can be set ... However, I have a very difficult time to get ImageView to scale correctly in the ListActivity or ExpandableListActivity line.

I tried setting the android: scaleType property for each individual value, but the image never scales. I also set the minimum and maximum sizes, and they don't seem to have any effect. I did both of these things in both XMl and code to no avail ...

Does anyone have any ideas or maybe workarounds?

Thanks in advance!

EDIT: Here is the XML for group rows in an ExpandableListView

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:padding="6dip" > <ImageView android:id="@+id/item_selection_icon_id" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginRight="5dp" android:layout_marginLeft="30dp" android:minWidth="10dp" android:minHeight="10dp" android:maxWidth="10dp" android:maxHeight="10dp" android:scaleType="centerInside" /> <!-- App Name --> <TextView android:id="@+id/item_app_name_id" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_toRightOf="@id/item_selection_icon_id" android:layout_alignBaseline="@id/item_selection_icon_id" android:textStyle="normal|bold" android:textSize="24sp" /> <!-- Package Information --> <TextView android:id="@+id/item_app_pkg_name_id" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@id/item_app_name_id" android:layout_toRightOf="@id/item_selection_icon_id" android:layout_weight="2" android:textStyle="italic" android:textSize="12sp" /> </RelativeLayout> 
+4
source share
1 answer

Thanks to Roman, this problem is solved! I removed the min and max width and height lines and changed the android: layout_width / height attributes to the size I wanted, and now everything works fine.

+8
source

Source: https://habr.com/ru/post/1307252/


All Articles