The itemdecoration of Recyclerview

Source: Internet
Author: User

Recently in the development of using Recyclerview, stealing a lazy to borrow Android to provide sample in the Divideritendecoration class to do the separation line, did not expect the middle of the separation line does not show the situation, in order to find out the reason, I added a paint in the class, Draw a line in the same place, this line shows, the original divider line is still not shown, it is possible that the Getdrawable method returned is null, so the class parameters modified a bit, the original is Getapplicationcontext (), Now change to GetContext (), the divider line is normal, and finally find out why, because Getapplicationcontext (). The Getdrawable () method is only available after android21, Running this method on the previous version throws a java.lang.NoSuchMethodError:android.content.Context.getDrawable exception, so the separator line does not appear.

The itemdecoration of Recyclerview

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.