开发者

Android ListView - Multiple <Selector> Tags

Is it possible to have multiple selector tags on a single listview...ie: change the background color of each item of the listview (alternating between two drawables), but still h开发者_如何学Pythonave the selector of the list view active for focus and click events?

Also, is it possible to ensure that the margin stays constant when using selector tags? For some reason, the margins and paddings all reset to zero...


You can extend your own Adapter and override the getView function as shown in this example:

http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/List14.html

Then simply use setDrawableResource to specify which selector you want based on the row position.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜