1
我目前正在使用forecast.io api構建天氣應用程序。 他們提供custom font for Forecast.io,以及其他apis,如雅虎。我不知道如何繼續使用他們的API mapping。Android - Forecast.io圖標標籤自定義字體:weather-icons
例如,我收到「部分多雲夜」,這應該呈現圖標。
我會歡迎有關如何進行的建議或線索。
非常感謝,
我目前正在使用forecast.io api構建天氣應用程序。 他們提供custom font for Forecast.io,以及其他apis,如雅虎。我不知道如何繼續使用他們的API mapping。Android - Forecast.io圖標標籤自定義字體:weather-icons
例如,我收到「部分多雲夜」,這應該呈現圖標。
我會歡迎有關如何進行的建議或線索。
非常感謝,
您必須使用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);