TextView
2018-12-07 本文已影响5人
汇源可乐
0x01:常用的属性:
| 属性 | 描述 |
|---|---|
| textColor | 文本颜色 |
| textSize | 字大小 |
| gravity | 居中方式 |
| background | 背景 |
| autoLink | all/email/map/none/phone/web点击会有相应的action[不能使用&] |
| singleLine | 单行 |
| lines | 最大允许几行 |
| ellipsize | 省略号显示属性 |
| typeface | 字体样式 |
设置字体的事例:
在AS里为工程新建一个assets文件夹,点击确定即可;
从windows的C:\Windows\Fonts Copy 一个字体到该目录下。
java Demo:
textView= (TextView)findViewById(R.id.hello);
textView.setTypeface(Typeface.createFromAsset(getAssets(),"ALGER.TTF"));
HELLO WORLD!