Skip to content

Instantly share code, notes, and snippets.

@codeforfun-jp
Created October 23, 2020 06:42
Custom Font (Java)
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