简体   繁体   中英

Android: add borders to ListView Items

How can we add custom borders around ListView Items in android.

I know I can use dividers with a custom drawable background but it does not add it for the first and last element and therefore if there is only 1 item in the list, it won't even display it.

Thanks a lot.

There are two xml-attributes called footerDividersEnabled and headerDividersEnabled

and they have their corresponding java methods setFooterDividersEnabled and setHeaderDividerseEnabled.

Hope this solves your problem!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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