Roboto font in my android app

前端 未结 3 797
名媛妹妹
名媛妹妹 2020-12-05 22:05

Hi i am writing an android app. And I want the roboto font in it irrespective of the version of the phone. Is there a way to do it?

Thanks, Rahim.

3条回答
  •  悲哀的现实
    2020-12-05 22:44

    Yeah why not, you can get the Roboto font :

    Android ICS typography

    Lets say you want to change the font of a text view :

       Typeface tf = Typeface.createFromAsset(getAssets(),
                "fonts/Roboto-Black.ttf");
        TextView tv = (TextView) findViewById(R.id.FontTextView);
        tv.setTypeface(tf);
    

提交回复
热议问题