Chandresh 204
Chandresh 204

Reputation: 350

android font in XML feature not working with AppWidget

Android 8.0 (API level 26) introduces a new feature, Fonts in XML, which lets you use fonts as resources. as shown here: https://developer.android.com/guide/topics/ui/look-and-feel/fonts-in-xml.

With this, I have successfully changed the font of the TextClock inside the activity but the above method is not working on AppWidget. AppWidget Still showing the system fonts.

here is my_app_widget.xml file...

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:padding="@dimen/widget_margin">

     <TextClock
           android:layout_width="wrap_content"
           android:textColor="#8FFF"
           android:layout_height="wrap_content" android:fontFamily="@font/opensans"/>

    </RelativeLayout>

is there any other method to change the TextClock fonts in AppWidget

Upvotes: 1

Views: 737

Answers (1)

khoshrang
khoshrang

Reputation: 156

here is the final answer to this problem, it won't get fixed in future this is google answer:

This is an intended change. Allowing custom fonts in app widgets was an unintended behavior and could also expose a security bug. In june update we have fixed that flaw.

Upvotes: 2

Related Questions