首页 > android版网易新闻、今日头条的中文字体是怎么设置的

android版网易新闻、今日头条的中文字体是怎么设置的

我发现网易新闻、今日头条的字体都偏细,偏扁,不同于默认的系统字体,反编译却没有发现字体文件,也没有发现自定义字体的地方,而且我更换系统字体后,他们也能自动采用新的系统字体。


这是网易新闻,你看他的字都比较扁、比较细。

再看看我们的应用,没有设置fontFamily和typeface之类的,比较粗


在 API 16 提供了一个 fontFamily 属性用于修改字体,name 可以从 %android-sdk%\platforms\android-16+\data\fonts\system_fonts.xml 获取到

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:paddingBottom="16dp"
    android:paddingLeft="16dp"
    android:paddingRight="16dp"
    android:paddingTop="16dp" >

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/hello_world"
        android:typeface="normal" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:fontFamily="sans-serif-thin"
        android:text="@string/hello_world" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:fontFamily="sans-serif-condensed"
        android:text="@string/hello_world" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:fontFamily="sans-serif-condensed-light"
        android:text="@string/hello_world" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:fontFamily="sans-serif-monospace"
        android:text="@string/hello_world" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:fontFamily="courier new"
        android:text="@string/hello_world" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:fontFamily="sans-serif-smallcaps"
        android:text="@string/hello_world" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:fontFamily="cursive"
        android:text="@string/hello_world" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:fontFamily="casual"
        android:text="@string/hello_world" />

</LinearLayout>

网易新闻的新闻页面是用的WebView


他们有的的字体都是花钱定制的,字体库里没有的

【热门文章】
【热门文章】