Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change font of text next to radio button?

Tags:

To change the font of a textView I used

TextView tv = (TextView) findViewById(R.id.textview);
Typeface font = Typeface.createFromAsset(getAssets(), "SF_Cartoonist_Hand_Bold.ttf");
tv.setTypeface(font);

I want to do something similar for the text next to a Radio Button, how do I go about doing that?

like image 920
scibor Avatar asked Jun 14 '13 16:06

scibor


People also ask

How to change font of radio button tkinter?

Step 1: Create a wx. Font object. Step 2: Add different attributes of font in parameters like: family, style etc. Step 3: Create a Radio Button.

How do I get text to select a radio button?

To select a radio button by clicking on its text in React:Add a label element for each radio button. The htmlFor prop of each label should be set to the id of each radio button. Click on the label element to select the radio button.


2 Answers

You set the font to the text next to a RadioButton the same way you do to a TextView:

RadioButton rb  = (RadioButton) findViewById(R.id.radiobutton);
Typeface font = Typeface.createFromAsset(getAssets(), "SF_Cartoonist_Hand_Bold.ttf");
rb.setTypeface(font);
like image 164
Piovezan Avatar answered Oct 30 '22 01:10

Piovezan


From the official doc:

Typeface typeface = getResources().getFont(R.font.myfont);
textView.setTypeface(typeface);
like image 42
Leo Nawroth Avatar answered Oct 30 '22 01:10

Leo Nawroth