2016-07-06 4 views
1

현재 forecast.io api를 사용하여 날씨 앱을 구축 중입니다. 그들은 야후와 같은 다른 API뿐만 아니라 custom font for Forecast.io을 제공합니다. 그들의 API mapping을 사용하는 방법을 잘 모르겠습니다.Android - 사용자 정의 글꼴에 대한 Forecast.io 아이콘 레이블 : weather-icons

예를 들어, "partly-cloudy-night"이 표시되고 아이콘이 렌더링되어야합니다.

진행 방법에 대한 조언이나 단서를 환영합니다.

덕분에 많이,

답변

1

당신은 TTF 파일 위원장 안드로이드 프로젝트를 사용하고, XML 문자열 ressource에 CSS를 변환해야합니다. 웹 호스팅 허브 글리프 (글꼴과 비슷하지만 더 많은 아이콘)를 사용했습니다.

내가 내 convertion 스크립트를 다시이 아이콘이있는 REPO을 할 수 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); 
관련 문제