3

Is it possible to set a customised font for an entire android application in one shot. I mean I do not want to use setTypeFace for every textview in every activity. And not only textviews but every possible text.

1
  • 4
    make your customized textview with custom font set, and use that textview instead of default textview Commented Aug 7, 2012 at 9:27

1 Answer 1

9

Just make your own TextView:

public class CustomFontTextView extends TextView {

// make every constructor call init();

  private void init() {
   setTypeFace(...);
  }

}

In xml:

<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
    <com.yourcompany.yourproject.views.CustomFontTextView
     android:layout_width="fill_parent"
     android:layout_height="fill_parent"
     android:text="Test"/>
</LinearLayout>
Sign up to request clarification or add additional context in comments.

4 Comments

not only textviews but everything, say buttons, web layout etc. in short all the text in the app
any solution for above comment ? i have made the necessary change in the question also.
There is no way to change it everywhere from the application.
following your answer, probably, one has to extend view class and then extend every view type used in the app

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.