Reputation: 11829
In my app there are several widget themes. These themes include .png files as widget background. One user asked me if I could make the widget background totally transparent. I created a new image (i am using GIMP) with 0% transparency, but in the app the widget is only like 20% transparent. I tried it with 0,1% also, same result. When I use 8,4%, the image has idk 8-20% transparency. I don't think that my code is wrong, since all the other backgrounds are working fine (one of them is 50% transparent).
Btw, I post my code. It would also be good if I could do that with no background, like disabling the background of the widget or something..
RemoteViews updateViews = new RemoteViews(EditPreferences.this.getPackageName(), R.layout.main);
updateViews.setTextColor(R.id.widget_textview, Color.rgb(208, 202, 202));
updateViews.setTextColor(R.id.widget_textview2, Color.WHITE);
updateViews.setTextColor(R.id.widget_textview3, Color.rgb(176, 175, 175));
updateViews.setImageViewBitmap(R.id.ImageView01, ((BitmapDrawable)EditPreferences.this.getResources().getDrawable(R.drawable.totaltransparent)).getBitmap());
ComponentName thisWidget = new ComponentName(EditPreferences.this, HelloWidget.class);
AppWidgetManager manager = AppWidgetManager.getInstance(EditPreferences.this);
manager.updateAppWidget(thisWidget, updateViews);
Upvotes: 0
Views: 842
Reputation: 11829
I added updateViews.setViewVisibility(R.id.ImageView01, View.INVISIBLE);
and now the I cannot see the imageview which is ok, but I cannot click on the widget (since the click is defined on the imageview).
Then I changed remoteViews.setOnClickPendingIntent(R.id.ImageView01, configPendingIntent);
to
remoteViews.setOnClickPendingIntent(R.id.widget_textview, configPendingIntent);
in the AppWidgetProvider class, and now I can click on the textviews to open the app!
Upvotes: 1