Android uses shape to draw dashed lines, and how not to show

Source: Internet
Author: User
Tags dashed line

Always thought that the shape of Android can draw straight lines, dashes, rectangles, circles, etc., Draw straight line also forget, with a view set the height and color, you can come out a straight line. So this is often not used for me, round is OK, see my application in the message prompt box is generated, OK, this does not exist, today want to do is a dashed line, nothing said, directly on the dotted line code:
<?xml version= "1.0" encoding= "Utf-8"? ><shape xmlns:android= "Http://schemas.android.com/apk/res/android"      android:shape= line >     <!--display a dashed line, the width of the broken polyline is Dashwith, the gap between the broken lines is dashgap, and when DASHGAP=0DP is solid--   <stroke android:width= "1DP" android:color= "#D5D5D5"                 android:dashwidth= "2DP" android:dashgap= "3DP"/ >                <!--dash height-      <size android:height= "2DP"/>    


Explain the good perfect, really want not not to try, estimate lifetime will believe this is true, the result is put on the cell phone, never appeared what line, for like me the pursuit of perfect people, nature will not let this a detail, in the Internet to find the majority of days, some small partners have also met, and also solved, But to take their methods to get over, are not a well, the actual situation is still can not be shown, summed up the solution of the small partners
1. Since android3.0, Android has turned off hardware acceleration so it cannot be displayed, so it is possible to turn off the hardware-accelerated function in Androidmanifest.xml, or in the activity: Hardwareaccelerated= "false" or view.setlayertype (View.layer_type_software, NULL);
2. A small partner of the translation, said what height to be greater than dashwidth to display.
I tried it their way, and I couldn't do it at all.
So if you want to make a real realization, just go ahead and draw a dashed line yourself.

Android uses shape to draw dashed lines, and how not to show

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.