-
-
Save codeforfun-jp/d4a04c3d88a834b66f2bd86167c7a76a to your computer and use it in GitHub Desktop.
Custom Font (Java)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package jp.codeforfun.customfont; | |
import androidx.appcompat.app.AppCompatActivity; | |
import android.graphics.Typeface; | |
import android.os.Bundle; | |
import android.widget.TextView; | |
public class MainActivity extends AppCompatActivity { | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
Typeface customFont = Typeface.createFromAsset(getAssets(), "Sofia-Regular.ttf"); | |
TextView myText = findViewById(R.id.myText); | |
myText.setTypeface(customFont); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment