有人知道怎么做吗?PagerTitleStrip类没有.setTypeface方法或类似的东西,所以我有点困惑。
我发现的另一个回复是:You are probably best served copying the PagerTitleStrip code (in your SDK or available online), refactor your fork into your own package, and modify it to suit.,但我不知道该怎么做。
任何帮助都将不胜感激。
发布于 2012-12-03 07:42:44
我只是复制了AOSP的源代码,并按我喜欢的方式制作了自己的源代码:
该文件可在android-sdk/extras/android/support/v4/src/java/android/support/v4/view/PagerTitleStrip.java中找到
发布于 2013-06-29 02:35:25
你不需要复制源代码--只需要复制子类。查看我的答案:how to change the font of a pagertitlestrip
发布于 2013-08-15 13:28:50
如果它是一个自定义字体,把它放在资产文件夹中,并像这样改变它。
PagerTitleStrip _Title = (PagerTitleStrip)rootView.findViewById(R.id.__Weekly_pager_title_strip);
Typeface font = Typeface.createFromAsset(getActivity().getAssets(), "Your font.ttf");
for (int counter = 0 ; counter<_Title.getChildCount(); counter++) {
if (_Title.getChildAt(counter) instanceof TextView) {
((TextView)_Title.getChildAt(counter)).setTypeface(font);
((TextView)_Title.getChildAt(counter)).setTextSize(25);
}
}https://stackoverflow.com/questions/13675206
复制相似问题