当前位置:首页 » 安卓系统 » android开发字体

android开发字体

发布时间: 2022-09-07 13:54:14

㈠ android app开发中默认的字体是什么字体

中文 思源黑体/ 英文 Robot
中文七个字重:Thin、 Light、DemiLight、Regular、Medium、Bold 和 Black
英文六个字重:Thin、Light、Regular、Medium、Bold 和 Black

㈡ android开发可以在xml资源文件里设置自定义字体吗

这个在xml中设置字体只能是系统内置的几种字体,如monospace、sans、serif等,
设置方法:android:typeface="monospace"

但是要是想设置自定义的、放在assert目录下的字体的话,只能在代码中去设置了:如:
Typeface font=Typeface.createFromAsset(this.getAssets(),"fonts/YourCustomFont.ttf");
textView.setTypeface(font);

㈢ 如何在Android开发中使用自定义的字体库

1、在Eclipse中新建Android工程fontdemo。代码很简单,只有MainActivity.java和CustomFontTextView.java。布局文件是activity_main.xml。assets下面是我们要使用的字体库文件。

2、核心代码是CustomFontTextView.java。CustomFontTextView继承自TextView,在初始化的时候读取自定义的字体库。

3、然后在布局文件中,像普通的TextView一样,引用我们自定义的这个文件。

4、MainActivity只是负责展示我们自定义的这个TextView。

看一下最终的运行效果。

㈣ android 开发 默认字体太粗 怎么设置细体

android:textStyle设置字形[bold(粗体) 0, italic(斜体) 1, bolditalic(又粗又斜) 2] 可以设置一个或多个,用“|”隔开
android:typeface设置文本字体,必须是以下常量值之一:normal 0, sans 1, serif 2, monospace(等宽字体)3]

㈤ android studio 开发用什么字体好

字体的话选择中文字体,微软雅黑bold也不错,重要的是选择自己喜欢的。

㈥ Android 开发中怎么使用自定义字体

1、Android系统默认支持三种字体,,分别为:“sans”, “serif”, “monospace
2、在Android中可以引入其他字体 。
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:Android=""
Android:layout_width="fill_parent"
Android:layout_height="fill_parent" >

<TableRow>

<TextView
Android:layout_marginRight="4px"
Android:text="sans:"
Android:textSize="20sp" >
</TextView>
<!-- 使用默认的sans字体 -->

<TextView
Android:id="@+id/sans"
Android:text="Hello,World"
Android:textSize="20sp"
Android:typeface="sans" >
</TextView>
</TableRow>

<TableRow>

<TextView
Android:layout_marginRight="4px"
Android:text="serif:"
Android:textSize="20sp" >
</TextView>
<!-- 使用默认的serifs字体 -->

<TextView
Android:id="@+id/serif"
Android:text="Hello,World"
Android:textSize="20sp"
Android:typeface="serif" >
</TextView>
</TableRow>

<TableRow>

<TextView
Android:layout_marginRight="4px"
Android:text="monospace:"
Android:textSize="20sp" >
</TextView>
<!-- 使用默认的monospace字体 -->

<TextView
Android:id="@+id/monospace"
Android:text="Hello,World"
Android:textSize="20sp"
Android:typeface="monospace" >
</TextView>
</TableRow>
<!-- 这里没有设定字体,我们将在Java代码中设定 -->

<TableRow>

<TextView
Android:layout_marginRight="4px"
Android:text="custom:"
Android:textSize="20sp" >
</TextView>

<TextView
Android:id="@+id/custom"
Android:text="Hello,World"
Android:textSize="20sp" >
</TextView>
</TableRow>

</TableLayout>
// 得到TextView控件对象
TextView textView = (TextView) findViewById(R.id.custom);
// 将字体文件保存在assets/fonts/目录下,创建Typeface对象
Typeface typeFace = Typeface.createFromAsset(getAssets(),"fonts/DroidSansThai.ttf");
// 应用字体
textView.setTypeface(typeFace);
如果想对整个界面的所有控件都应用自定义字体,可以:

package arui.blog.csdn.net;
import android.app.Activity;
import android.graphics.Typeface;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
public class FontManager {
public static void changeFonts(ViewGroup root, Activity act) {
Typeface tf = Typeface.createFromAsset(act.getAssets(),
"fonts/xxx.ttf");
for (int i = 0; i < root.getChildCount(); i++) {
View v = root.getChildAt(i);
if (v instanceof TextView) {
((TextView) v).setTypeface(tf);
} else if (v instanceof Button) {
((Button) v).setTypeface(tf);
} else if (v instanceof EditText) {
((EditText) v).setTypeface(tf);
} else if (v instanceof ViewGroup) {
changeFonts((ViewGroup) v, act);
}
}
}
}

㈦ android app开发中默认的字体是什么字体

1、Clockopia.ttf
系统默认待机时钟字体;
2、DroidSans.ttf
系统默认英文字体;
3、DroidSans-Bold.ttf
系统默认英文粗字体;
4、DroidSansFallback.ttf
系统默认中文字体;

Android
系统中,DroidSans
是默认字体,只包含西方字符(英文),应用程序默认情况下都会调用它;而
Droid
Sans
Fallback
包含了东亚字符(繁体中文、简体中文、韩文、日文)。当需要显示的字符在
Droid
Sans
字体中不存在(如汉字),即没有对应编码的字符时,系统会到
Droid
Sans
Fallback
中去寻找相应编码的字符,如果找到,则使用
Droid
Sans
Fallback
字体来显示它,如果仍然找不到该编码对应的字符,则系统无法在屏幕上显示出这个字符。同时DroidSansFallback.ttf
字体文件的体积仅有
3.04MB大小,效果类似于微软雅黑字体,而且是完全免费的。

㈧ Android UI设计字体大小规范

Android UI设计字体,由于android厂商和设备之多,目前没有特定的标准,但根据设备的尺寸,有一个建议的原则,如下:

sp和dp一样,是android开发里特有的单位,设计师在做UI设计的时候通常最初是建立320*480这个尺寸的画布开始的,这个尺寸的画布在android分辨率的分类中称为mdpi,在这个尺寸下,ps里的1px就等于android中的1dp,同样,这个时候1点的字就等于android中1sp。

㈨ Android开发中如何为应用设置全局字体(第三方字体)

最简单的就是自定义TextView
,所有的显示文字都用这个,然后控制一个textview就好了

热点内容
服务器怎么证明是好的 发布:2024-05-17 18:39:28 浏览:682
树莓派如何搭建mqtt服务器 发布:2024-05-17 18:27:38 浏览:436
门口机sip服务器ip是什么 发布:2024-05-17 17:38:27 浏览:553
光遇安卓区是什么服 发布:2024-05-17 17:22:25 浏览:24
linux驱动开发教程 发布:2024-05-17 17:19:52 浏览:501
抖音中秋节视频脚本 发布:2024-05-17 17:19:51 浏览:194
快递柜为什么用安卓系统 发布:2024-05-17 17:17:18 浏览:907
电脑配置光纤接口怎么标注 发布:2024-05-17 17:06:56 浏览:977
如何用方向键控制安卓机 发布:2024-05-17 16:38:11 浏览:199
雨田系统源码 发布:2024-05-17 16:28:06 浏览:587