android change listview font and color

后端 未结 5 1689
轮回少年
轮回少年 2020-12-07 02:40

I\'ve found loads of different ways of accomplishing this but I\'m not sure what\'s the best for my scenario.

This is my Java code for the listview:

         


        
5条回答
  •  庸人自扰
    2020-12-07 03:25

    The list view itself isn't responsible for drawing the items, it uses an adapter to create the list items. This adapter creates a view to display the list item when required. To change the font used to display the list item, you have to change the adapter to return a view with the new font. This can be done in the Adapter.getView method. If you are currently using a standard Adapter implementation, you may need to subclass it (or completely replace it).

提交回复
热议问题