-
19
-
20
-
21
-
22
import android.content.Context; import android.graphics.Typeface; import android.widget.TextView; /** * @author yuyh. * @date 2016/11/10. */ public class MDFontsUtils { public static Typeface OCTICONS; /** * Get octicons typeface * * @param context * @return octicons typeface */ public static Typeface getOcticons(final Context context) { if (OCTICONS == null) OCTICONS = getTypeface(context, "fonts/icomoon.ttf"); return OCTICONS; } /** * Set octicons typeface on given text view(s) * * @param textViews */ public static void setOcticons(final TextView... textViews) { if (textViews == null || textViews.length == 0) return; Typeface typeface = getOcticons(textViews[0].getContext()); for (TextView textView : textViews) textView.setTypeface(typeface); } /** * Get typeface with name * * @param context * @param name * @return typeface */ public static Typeface getTypeface(final Context context, final String name) { return Typeface.createFromAsset(context.getAssets(), name); } }
-
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
-
22
-
23
-
24
-
25
-
26
-
27
-
28
-
29
-
30
-
31
-
32
-
33
-
34
-
35
-
36
-
37
-
38
-
39
-
40
-
41
-
42
-
43
-
44
-
45
-
46
-
47
-
48
-
49
9、图标对应是用TextView表示,而不是ImageView。如下:
<TextView android:id="@+id/tvMusic" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="10dp" android:textSize="16dp" /> <TextView android:id="@+id/tvHome" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="10dp" android:textSize="16dp" />
-
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
在Java中应用字体。如下:
tvMusic = (TextView) findViewById(R.id.tvMusic); tvMusic.setText(MDFonts.MUSIC); tvHome = (TextView) findViewById(R.id.tvHome); tvHome.setText(MDFonts.HOME); // 应用字体 MDFontsUtils.setOcticons(tvMusic, tvHome);
-
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
run起来,大功告成!
10、你会发现,run起来图标颜色全是Android默认的灰色,那么怎么更改图标颜色呢?刚才说了,图标字体用的是TextView,实际上他跟中文英文字体没什么两样,他本质上还是文字。所以,TextView怎么设置字体大小、字体颜色,这里就对应怎么设置。如下:
tvHome.setTextColor(Color.RED); tvHome.setTextSize(50);
-
1
-
2
哈哈,没毛病!
当然,也可以把字体符号配置在string.xml
<string name="icon_home" translatable="false">\ue902</string>
- 1
如何成为Android高级架构师!
架构师必须具备抽象思维和分析的能力,这是你进行系统分析和系统分解的基本素质。只有具备这样的能力,架构师才能看清系统的整体,掌控全局,这也是架构师大局观的形成基础。 你如何具备这种能力呢?一是来自于经验,二是来自于学习。
架构师不仅要具备在问题领域上的经验,也需要具备在软件工程领域内的经验。也就是说,架构师必须能够准确得理解需求,然后用软件工程的思想,把需求转化和分解成可用计算机语言实现的程度。经验的积累是需要一个时间过程的,这个过程谁也帮不了你,是需要你去经历的。
但是,如果你有意识地去培养,不断吸取前人的经验的话,还是可以缩短这个周期的。这也是我整理架构师进阶此系列的始动力之一。
成为Android架构师必备知识技能
对应导图的学习笔记(由阿里P8大牛手写,我负责整理成PDF笔记)
部分内容展示
《设计思想解读开源框架》
- 目录
- 热修复设计
- 插件化框架设计
《360°全方面性能优化》
- 设计思想与代码质量优化
- 程序性能优化
网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。
一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!
)]
- 程序性能优化
[外链图片转存中…(img-JVnIdb7p-1714393675677)]
网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。
一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!