使用说明
- 在assets创建fonts文件夹,并把字体放在里面
- 在Activity中更换字体
tv_time=(TextView)findViewById(R.id.tv_time);
tv_time.setTypeface(Typeface.createFromAsset(getAssets(), "fonts/arial.ttf"));
tv_title=(TextView) findViewById(R.id.tv_title);
tv_title.setTypeface(Typeface.createFromAsset(getAssets(), "fonts/SourceHanSansCNBold.otf"));
- 在布局文件中设置无边界 android:includeFontPadding=“false”
<TextView
style="@style/normal_text"
android:text="系统"
android:layout_centerHorizontal="true"
android:id="@+id/tv_title"
android:textSize="25sp"
android:includeFontPadding="false"
/>