How to change the font in a
TextView
, as default it's shown up as Arial? How to change it
to Helvetica
?
Wednesday 22 November 2017
android - How to change the font on the TextView?
First, the
default is not Arial. The default is Droid
Sans.
Second, to change to a
different built-in font, use android:typeface
in layout XML or
setTypeface()
in
Java.
Third, there is no Helvetica font in
Android. The built-in choices are Droid Sans (sans
), Droid Sans
Mono (monospace
), and Droid Serif
(serif
). While you can bundle your own fonts with your
application and use them via setTypeface()
, bear in mind that
font files are big and, in some cases, require licensing agreements (e.g., href="http://www.linotype.com/526/helvetica-family.html" rel="noreferrer">Helvetica,
a Linotype
font).
EDIT
The Android design language relies on traditional typographic tools
such as scale, space, rhythm, and alignment with an underlying
grid.
Successful deployment of these tools is essential to help
users
quickly understand a screen of information. To support such use
of
typography, Ice Cream Sandwich introduced a new type family
named
Roboto, created specifically for the requirements of UI and
high-resolution screens.
The current TextView
framework offers Roboto in thin, light, regular
and bold weights, along with
an italic style for each weight. The
framework also offers the Roboto
Condensed variant in regular and bold
weights, along with an italic style for
each
weight.
After
ICS, android includes Roboto fonts style,
Read more href="http://developer.android.com/design/style/typography.html"
rel="noreferrer">Roboto
EDIT
2
With the advent of Support Library 26, Android now supports custom fonts by
default. You can insert new fonts in res/fonts
which can be set to TextViews individually either in XML or programmatically. The
default font for the whole application can also be changed by defining it styles.xml The
android developer documentation has a clear guide on this href="https://developer.android.com/guide/topics/ui/look-and-feel/fonts-in-xml.html"
rel="noreferrer">here
php - file_get_contents shows unexpected output while reading a file
I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...
-
I have an app which needs a login and a registration with SQLite. I have the database and a user can login and register. But i would like th...
-
I would like to use enhanced REP MOVSB (ERMSB) to get a high bandwidth for a custom memcpy . ERMSB was introduced with the Ivy Bridge micro...
-
According to my understanding, and my calculator, cos(90 degrees) equals 0 . In my code, I have a funct...
No comments:
Post a Comment