Custom Font in View Pager in android

╄→гoц情女王★ 提交于 2020-01-22 02:33:11

问题


I am developing demo application in which I am using view pager. Now I want to know that can we change the text style of Title displayed in view pager.

Please give your suggestions on it.

Thanking you in advance.


回答1:


Working demo

TextView txt = (TextView) v.findViewById(R.id.custom_font);  

and then change your font

Something like this:

switch (position) {
     case 0:
            v = (LinearLayout) LayoutInflater.from(cxt).inflate(R.layout.lcmeter, null);
            TextView txt = (TextView) v.findViewById(R.id.custom_font); 
            Typeface font = Typeface.createFromAsset(getAssets(), "Chantelli_Antiqua.ttf");  
            txt.setTypeface(font); 
            break;
     }


来源:https://stackoverflow.com/questions/12819531/custom-font-in-view-pager-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!