I am developing a widget with an image on the rigth side, which can be choosen by the user in one of the settings screen. The image can then be set from the user with the ImageView.setScaleType("CENTER"). That works. The URL of the image is then stored in the preferences as URL, and also as Base64 encoded String of the Bitmap (cause I want to shrink the image and the user can rotate it in the settings)
In the widget, I load the image. That works fine. With the URI and with the Bitmap too. The ScaleType of the ImageView is set as well to a fixed value in the Layout, works too.
But how can I define the ScaleType of the ImageView in the widget programmatically? Cause I want to set the ScaleType to the value, the user has choosen in the settings. With RemoteViews, we cannot get the ImageView...
I tried:
myRemoteViews.setString(R.id.myImage, "setScaleType", "CENTER");
The logfile says: The function setScaleType is not possible for ImageView.
Does someone know how to make this definition inside the AppWidget?
You can use this segment to set scale type for Image View programatically..
imgview.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
Hope it helps...