У меня есть widget.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/widget"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="true"
style="@style/WidgetBackground">
<ImageView
android:id="@+id/myimage"
android:layout_width="20dip"
android:layout_height="20dip"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:src="@drawable/myimage" />
<TextView
android:id="@+id/mytext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/WidgetText.Title" />
Как я могу изменить размер изображения?
[Service]
public class UpdateService : Service
{
public override StartCommandResult OnStartCommand(Intent intent, StartCommandFlags flags, int startId)
{
var updateViews = new RemoteViews(context.PackageName, Resource.Layout.widget);
// changing textsize works perfectly:
updateViews.SetTextViewTextSize(Resource.Id.mytext, (int)ComplexUnitType.Sp, 14);
updateViews.SetViewVisibility(Resource.Id.myimage, ViewStates.Gone);
updateViews.SetTextViewText(Resource.Id.text, "new text");
// but changing imagesize does not work, I didn't find a right way to set the size, need something like this:
updateViews.SetInt(Resource.Id.myimage, "layout_width ???", 200dip ???);
ComponentName thisWidget = new ComponentName(this, Java.Lang.Class.FromType(typeof(Widget)).Name);
AppWidgetManager manager = AppWidgetManager.GetInstance(this);
manager.UpdateAppWidget(thisWidget, updateViews);
}
updateViews имеет несколько setInt, setFloat, Set .. но я не сделалНе найти правильный метод.Любой намек, пожалуйста?