I'm developing a 4x2 App Widget for a music app I'm developing.  It 
contains an ImageView for the album art.  I want to set the ImageView's 
width equal to its height so the album art display is square-shaped.  The 
height of the imageview is dependent upon other elements in the 
RelativeLayout.  In an Activity this is easy to accomplish by retrieving 
the imageview's layoutParam object and using setLayoutParams to modify it.  
However on an App Widget, apparently there's no way to retrieve a view's 
current height since we're using RemoteViews.
 
I've come up with a few other ideas, but none of them seem feasible.  They 
include:
 
-  Subclass ImageView and perform the layout update in the new custom 
class:  Apparently it's not possible to use a subclass on an App Widget
 
-  Use a pre-defined width/height (in dp) for the ImageView and have the 
other elements above and below it be relative to the ImageView:  I can come 
up with values that work on my device, but it seems the height of a cell 
(even in dp units) varies between devices and even various launchers.
 
-  Somehow retrieve the height of the App Widget and calculate the height 
of the ImageView and modify the width accordingly - I can't find any way to 
determine the height of the App Widget.
 
 So is there any way to accomplish this on an App Widget?  Basically I need 
the width of an ImageView to match its height (which is determined by the 
heights of other elements above and below it in the App Widget).  Any help 
would be appreciated...I've been working on this issue for a few days now.
 
 
        Dan

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to