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