Is it possible to set programatically a font size (in pixels) for the text in a button, without using xml styles? Using Html.fromHtml(..) with font size=”..” didn’t worked.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use
Button.setTextSize()(since the button class extends a simple TextView):Note though that it is not recommended to use pixels as a dimension at all, rather use sp when working with font sizes. Otherwise you will run into display problems on many devices due to the many different screens out there.