开发者

How to add a circle to ListView

开发者 https://www.devze.com 2023-03-29 04:12 出处:网络
I have a li开发者_StackOverflowstview.I want to put texts and a circle filled with specific color in listview items.Text are different but circle should have one color only.Anyone having idea how to d

I have a li开发者_StackOverflowstview.I want to put texts and a circle filled with specific color in listview items.Text are different but circle should have one color only.Anyone having idea how to do it?


You need to create a custom ListAdapter, override its getView() method and return any view you want. Usually BaseAdatper or ArrayAdapter classes are used as the base class. Then you need to attach this adapter to the ListView using ListView.setAdapter() and that's all.


you can use a shapedrawable for the view of circle and create your own custom adapter (for example see link http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/List4.html

0

精彩评论

暂无评论...
验证码 换一张
取 消