2016-07-06 35 views

回答

1

您必須使用TTF文件IL您的Android項目,以及CSS轉換爲XML字符串的ressource。 我做了虛擬主機中心字形(有點像字體真棒,但更多的圖標)。

https://github.com/neoteknic/whhg-to-android

我可以重用我皈依腳本的製作與這些圖標的回購。

編輯: 這是給你: https://github.com/neoteknic/weather-icons-to-android

要使用它(我喜歡負荷只有一次的字樣,並使其全局可用):

public class YourAppName extends Application { 
    public static Typeface weatherIcons; 

    @Override 
    public void onCreate(){ 
YourAppName.weatherIcons= Typeface.createFromAsset(getApplicationContext().getResources().getAssets(), "fonts/weathericons-regular-webfont.ttf"); 
     super.onCreate(); 
    } 
} 

然後,當你想使用它:

TextView myicon=(TextView) findViewById(R.id.myicon); 
myicon.setTypeface(YourAppName.weatherIcons); 
myicon.setText(R.string.wi_day_snow_wind);