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.
-
4make your customized textview with custom font set, and use that textview instead of default textviewrajpara– rajpara2012-08-07 09:27:28 +00:00Commented Aug 7, 2012 at 9:27
Add a comment
|
1 Answer
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>
4 Comments
John Watson
not only textviews but everything, say buttons, web layout etc. in short all the text in the app
John Watson
any solution for above comment ? i have made the necessary change in the question also.
Vladimir Ivanov
There is no way to change it everywhere from the application.
John Watson
following your answer, probably, one has to extend
view class and then extend every view type used in the app