Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

how to change custom font to bold italic in java

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        Typeface font = Typeface.createFromAsset(getAssets(), "fonts/bebas_neue_regular.ttf");

        TextView tvNormal = (TextView) findViewById(R.id.normal);
        tvNormal.setTypeface(font);

        TextView tvBold = (TextView) findViewById(R.id.bold);
        tvBold.setTypeface(font, Typeface.BOLD);

        TextView tvItalic = (TextView) findViewById(R.id.italic);
        tvItalic.setTypeface(font, Typeface.ITALIC);


        TextView tvBoth = (TextView) findViewById(R.id.boldItalic);
        tvBoth.setTypeface(font, Typeface.BOLD_ITALIC);
    }
}
Comment

java font bold italic

Font plainFont = new Font("Arial", 0, 10); // PLAIN
Font boldFont = new Font("Arial", Font.Bold, 10); // BOLD
Font italicFont = new Font("Arial", Font.Italic, 10); // ITALIC
Font boldItalicFont = new Font("Arial", Font.Bold + Font.Italic, 10); // BOLD and ITALIC
Comment

PREVIOUS NEXT
Code Example
Java :: find last element in array in java 
Java :: Date(Long) to integer and back 
Java :: System.out.printf("%"+(n)+"s ") 
Java :: The this(Keyword) 
Java :: room library android 
Java :: integer to binary java 
Java :: splay tree java implementation 
Java :: how to create folder java 
Java :: zweidimensionales array ausgeben java 
Java :: print 1 to 10 using thread in java 
Java :: JFrame frame = new JFrame (); 
Java :: vscode code formatter cannot format 
Java :: smart ways to print a matrix in java 
Java :: import javafx 
Java :: regular expression java 
Java :: print a list java 
Java :: arraylist 
Java :: java lambda expressions 
Java :: lowercase string java 
Java :: java anonymous class 
Java :: queue.isempty java 
Java :: copy linked list 
Java :: R8: java.lang.OutOfMemoryError: GC overhead limit exceeded react-native 
Java :: intelilj javadoc: error - Malformed locale name: UTF8 
Java :: round decimals in java string 
Java :: java print 2d array row and column 
Java :: java require non null 
Java :: java interface 
Java :: Java How to use NavigableSet? 
Java :: android check file extension 
ADD CONTENT
Topic
Content
Source link
Name
8+1 =