Wednesday, March 14, 2012

[android-developers] Handling different icon dimensions from Apps.

I have a requirement wherein I have to enumerate all the installed apps and show their names along with their icons.
 
I'm using a grid view for this.
 
Inside the grid view, I have an imageview for showing the app's icon and a textview to show the app name.
I have a problem, in the sense every app has got different icon dimensions.
So some icons appear huge, whereas others appear normal.
 
How do I ensure that all icons are of the same width and height?
 
I'm using the following properties for ImageView:

<

ImageView android:id="@+id/icon"

android:layout_width="75.0dip"

android:layout_height="75.0dip"

android:maxWidth="75.0dip"

android:maxHeight="75.0dip"

android:width="75.0dip"

android:height="75.0dip"

android:scaleType="centerInside"

android:adjustViewBounds="true"

android:paddingLeft="5dp"

android:paddingTop="0dp"

android:paddingRight="10dp"

android:paddingBottom="10dp"

android:gravity="left"

android:src="@drawable/defaulticon"/>

 
 

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment