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);