简体   繁体   English

android listview字体动态变化

[英]android listview fonts change dynamically

I am creating application where in i have used preferences for changing font settings. 我正在创建应用程序,其中我使用了首选项来更改字体设置。 I want to change the list view 's text through those preference values. 我想通过这些首选项值更改列表视图的文本。 Have used check box preference for bold and italic. 已将复选框首选项用于粗体和斜体。 and list preference for font size How can i do this? 并列出字体大小的首选项我该怎么做? Please guide me. 请指导我。

In your ListView's adapter: 在您的ListView的适配器中:

public View getView(int position, View convertView, ViewGroup parent) {
    TextView tv;
    if(convertView==null){
        tv=new TextView(...); //create new TextView
    }else tv=(TextView) convertView;

    //now here set your tv text, font etc.

    return v;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM