How to use Custom Font in Android Widget? - android

Well, I'm making one Android app which can display Time and Date in App Widget(in HomeScreen).
I Loaded my Font under Assets -> Fonts.
Even after trying with FontFamily it doesn't work.
I'm sure font family doesn't work in widgets. I don't have any idea about this.
Thanks for your Help :)

Setting fontFamily in a homescreen widget layout file, like this
android:fontFamily="#font/cherry_swash"
does correctly display a custom font in homescreen widget TextViews with Android O and P, but not with earlier versions.

Related

Android setting fontWeight for system default fonts

I am wondering if it is possible to set the font weight without setting a custom font for Textview. Because i can see that android:textFontWeight attribute works fine when i am using with a custom font but if i don't set any custom font for the textview it just doesn't work.
PS: I don't want to use a custom font
Do you guys came across this before?

Android Studio, Design view font change

I changed the font in my application to a custom font, but I don't know how to change the font in Android Studio in the design view, where you can drag n drop buttons, textviews, etc.... Any ideas? Because of this I can't position correctly the buttons on my layout, because it's different in emulator, and different in design view. Thanks for help!
If you want to use the custom font in android you have to add that font in assets and use it from there. Use these links 1 & 2 hope this can help
You can't set custom font at design view. you set custom font using only java code.

Android - Justify alignment and custom font for Texts in Arabic and Persian languages

I am developing an android application and I strongly need to use Justify text alignment and also I should use custom font for texts. my application is in Persian language.
If I use TextView for showing texts I cant set text alignment to Justify.
If I use WebView and load html to it I cant use font for it (I know that I can set font using html and css but it does not work for some languages like Persian and Arabic , I tested it, only on android 4.4.2 i see my custom font but on other versions of android webview show android default font)
I tried converting font to SVG but nothings changed.
also I searched in github for a custom webview or textview , I fount one custom textView , both font and text alignment was ok but the direction was left to right but i need it be right to left (I tried changing gravity and other things but cant fix problem).
So what is your suggestion ?
Thank you so much for helping.
Regards.
Take a look at this forum.I used this library with the following attrs and everything works perfectly:
ext:documentView_reverse="true"
ext:documentView_textAlignment="justified"
ext:documentView_textFormat="formatted"

how to set the DEFAULT system font in android app?

Can I set the default font which is bydefault set in android app irrespective of which font user has selected???
Thanks in advance
As a developer there is no easy way to use a specific font in every screen of your app.
You have to set your custom font on each and every UI element. This is explained here.
Alternatively you can use this CustomFont helper class to change every UI elemnt for you.

Change font in all app or at least in Tab

Ok my first question is:
Is there a way to change the font on everything in my app? I mean to put for ex the font x.ttf to be the default font for all the buttons,listviews,for everything that is in my app? And if yes,how?
And my second question:
If that is not possible,then please tell me how to change the font on the Tab widget...
Thanks
Still There is no way to change the font for a complete application. All You can do is for Text Views create custom Text View and override the font method. Then you can use the customized text view rather than using the default text view.
This is the way I used the font Helvetica for My app.

Categories

Resources