android - Custom Font for Entire Application -
I want to change the font for the whole app content (textview, edit, button, etc) I have found that I can make setup style for the application but here I can not put the font in my custom style xml from the property folder. I have to put my custom TTF font in the Typeface Element in the Style XML from the Asset folder. I can not convert the monospace font in my custom font to my style
& lt; Resources & gt; & Lt; Style name = "heading_text" & gt; & Lt; Item name = "android: textColor" & gt; # Ff000000 & lt; / Item & gt; & Lt; Item name = "Android: Text Style" & gt; Bold & lt; / Item & gt; & Lt; Item name = "Android: text size" & gt; 16sp & lt; / Item & gt; & Lt; Item name = "Android: Typeface" & gt; Monospace & lt; / Item & gt; & Lt; / Style & gt;
Hi, go to my blog where you can download There are codes too.
What you need to do is to create a custom view specifically with the required font and use it wherever you want.
Let's say there is a text view for this purpose, custom text. Java code is as follows
package com.jitesh.customfonts; Import android.content.Context; Import Android.graphics. Typefaces; Import android.util.AttributeSet; Import android.widget.TextView; Public class Kstmtekst Vijhu Tekstwu (public custom Tekstwu (REFERENCES, Attribetset Etters, Int Difstail) enhances {super (context, Etters, Defstail); this ();} public CustomTextView (reference context, AttributeSet attrs) {super ( context, attrs); this ();} public CustomTextView (references) {super (context); this ();} public void Init () {typeface Tiff = Taipfesksentfrmasset (getContext (). GetAssets (), "FO T / Mandaptr. TTF "); Settaipfes (TF, 1);}} It uses the following XML
& lt; com.jitesh .customfonts.CustomTextView android: id = "@ + id / custom 1" Android: Layout_width = "wrap_content" android: layout_height = "wrap_content" android: layout_alignParentLeft = "true" android: layout_alignParentTop = "true" Android: layout_marginTop = "70dp "android: text =" @ string / hello_jitesh "Equipment reference =". main activity "& gt; & LT; /com.jitesh.customfonts.CustomTextView> Make sure also That the fonts / handmade tabs on your font asset Ipraitr. TTF is available with .
Comments
Post a Comment