我正在使用下面的代码使用 remoteview 在小部件 imageview 上设置图像现在我想将高度和宽度设置为 imageview 运行时。
if (appWidgetId != AppWidgetManager.INVALID_APPWIDGET_ID) {
AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(WidgetActivity1_1.this);
RemoteViews remoteViews = new RemoteViews(WidgetActivity1_1.this.getPackageName(), R.layout.widget_layout1_1);
Intent configIntent = new Intent(WidgetActivity1_1.this,UpdateWidgetService.class);
configIntent.putExtra("Appid", appWidgetId);
PendingIntent configPendingIntent = PendingIntent.getService(WidgetActivity1_1.this, appWidgetId, configIntent, 0);
remoteViews.setImageViewResource(R.id.imgviewGrow, R.drawable.flower1);
}