/MainActivity.java Secret
Created
October 23, 2020 06:42
Custom Font (Java)
This file contains hidden or 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