How can I change the font / typeface of a button in an Android widget? When working with normal view is this no problem:
// Within the app
Button myButton = (Button)rootView.findViewById(R.id.myAppButton);
myButton.setTypeface(someTypeface);
However, when working with a widget, views cannot be accessed directly but only via RemoteViews:
// Widget
RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.widgetContent);
remoteViews.setTextViewText(R.id.myWidgetButton, "Some Text");
Is it somehow possible to set the typeface of the remote button as well?
There is no way to change the typeface of TextView in RemoteView.
To check properties that can be changed in RemoteView, go to
android.widget.Buttonandandroid.widget.TextViewclasses and check all methods with annotation@android.view.RemotableViewMethod. As you can see, setTypeface method has no annotation, so it can not be changed in RemoteView.