How can I add gradient effect to background color of TextView in a ListView?

前端 未结 3 2031
渐次进展
渐次进展 2020-12-24 01:54

In reference to these questions :

Adding gradient effect to TextView in a ListView generates NPE

and

How to change color and font on ListView

<
3条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-24 02:16

    You just need to create a drawable resource (see an example below), and add it to the layout you created for your ListItem.

    The drawable (in your res\drawable folder - name it whatever - listgrad.xml for ex) could look like:

    
         
    
    

    The you would add it to the layout for your list item (the layout.xml file you define for this) like this code snippet:

    
    ...
    

提交回复
热议问题