虛線在4.0以上無法正常顯示,所以對顯示虛線的元件關閉硬體加速,讓其可以正常顯示
可以針對單一元件關閉硬體加速:
.java
TextView.setLayerType( View.LAYER_TYPE_SOFTWARE, null ) ;
.xml
.xml
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="line" >
<!-- dashWith:破折限寬 -->
<!-- dashGap:線與線的空隙寬,當dashGap為0則為實線 -->
<stroke
android:dashGap="5dp"
android:dashWidth="5dp"
android:width="1px"
android:color="@color/blue" />
</shape>
reference:
http://www.cnblogs.com/ansionchen/archive/2013/04/08/3019086.html
沒有留言:
張貼留言