"Android uses shape to draw dashed lines, show solid lines on more than 4.0 of mobile phones" solution

Source: Internet
Author: User

Problem Description:

Draw a dashed line with the following 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:dashgap= "3DP"        android:dashwidth= "3DP"        android:width= "1DP"        android: Color= "#dcdcdc"/><!--Dash Height--    <size android:height= "1DP"/></shape>

The code that references the dashed line in the layout file is as follows:

            <imageview                android:layout_width= "match_parent"                android:layout_height= "2dip"                android:layout_ Margin= "5dip"                android:background= "@drawable/dotted_line"/>

Note: Dotted_line is the name of the shape file


The graphics in the graphical layout view that ADT comes in are:



No problem, but running to the phone has become a solid line!!! , there is wood there!!!


Solution:

Locate the project's Androidmanifest.xml file and add the attribute value (disable hardware acceleration) in the Application tab as follows:



Then run the code again, problem solved!

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

"Android uses shape to draw dashed lines, show solid lines on more than 4.0 of mobile phones" solution

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.