2

I am trying to create an android app that will change the font at the push of a button. I have searched through stackoverflow and other sites on Google, but have come up empty handed. I am using Eclipse. The goal is to be able to simply touch a button that reads "times new roman" and then have the text above change to that font. I found people trying to change the font in Eclipse, or simply the default font for their app, but not have the user be able to change it. I got this idea after finding an app that changes background colors. Does anyone know what code I need for the buttons?

1 Answer 1

1

Typeface is what you are looking for.

In the onclicklistener of the button, try something like

TextView txt=(TextView)findViewById(...);
Typeface tf=Typeface.createFromAsset(...);
txt.setTypeface(tf);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.