have done it ? Or give some tips ! Thank
------ Solution --------------------------------------- -----
by defining the style of the font size , use the xml in each style , you can change the application's font
------ Solution --------- -----------------------------------
import a font into the assets folder inside, call setFront method, you can set the size of the text font color, etc.
------ Solution ---------------------------- ----------------
try this ,
add style in styles.xml
then in the activity 's onCreate first line setTheme (R.style.MyTheme); on it.
Note that setTheme only super.onCreate called before , so if it is already open activity must be restarted to be effective.
However, this must also build a lot of style to achieve multiple font sizes.
------ Solution ------------------------------------ --------
private static final float DefaultButtonFontSize = 20f;
private static final float DefaultTextFontSize = 16f;
public static void loadDefaultFontSize(View view){
if (view instanceof TextView) {
loadFontSize(view,DefaultTextFontSize);
}else if (view instanceof Button) {
loadFontSize(view,DefaultButtonFontSize);
}
}
public static void loadFontSize(View view, float size) {
if (view instanceof TextView) {
((TextView) view).setTextSize(size);
}else if(view instanceof Button) {
((Button) view).setTextSize(size);
}
}
To invoke when loadDefaultFontSize on it
------ Solution ---------------------------- ----------------
above wrong , Button inherited child TextView
so you have to change the next sequential
private static final float DefaultButtonFontSize = 20f;
private static final float DefaultTextFontSize = 16f;
public static void loadDefaultFontSize(View view){
if (view instanceof Button) {
loadFontSize(view,DefaultTextFontSize);
}else if (view instanceof TextView) {
loadFontSize(view,DefaultButtonFontSize);
}
}
public static void loadFontSize(View view, float size) {
if (view instanceof Button) {
((Button) view).setTextSize(size);
}else if(view instanceof TextView) {
((TextView) view).setTextSize(size);
}
}
------ Solution ------------------------------------- -------
method applies to dynamically modify the font size, every time you need to call , if you want to modify the application's font size, proposed to amend the style, or there are kinds of use dimens.xml, give you a reference
http://www.oschina.net/code/explore/android-4.0.1/core/res/res/values-w720dp/dimens.xml
------ eference --- ------------------------------------
is to manually change the font size of the program ?
------ eference --------------------------------------- < br>
is to change the font size of the entire application , rather than a place of textview.
------ eference ---------------- -----------------------
If you want the font size from 1-30 , would not have 30 styles ? I do not know I got it wrong not
------ eference --------------------------------- ------
software is running , you can dynamically modify the software fonts?
------ eference --------------------------------------- < br>
Yes
------ eference -------------------------------- -------
is setFont right ?
can give a simple example to see?
------ eference --------------------------------------- < br>
well, you can try
------ eference ----------------------------- ----------
passing , learning
------ eference ----------------------- ----------------
a theme Tool can modify it
------ eference -------------- -------------------------
Will the entire application can be realized inside the font size?
------ eference --------------------------------------- < br> I want to know , the landlord now have the solution yet ?
------ eference --------------------------------------- < br>
not yet
------ eference - --------------------------------------
not yet
So, now find no ?
没有评论:
发表评论