Android的虚线/点线的问题? [英] Android Dash/doted line issue?

查看:644
本文介绍了Android的虚线/点线的问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在IAM期运用Android的点线是做工精细的小屏幕,但我用这个code三星S3设备和更高版本无法正常工作......

这些截图;

这是code是用.....

绘制/ dashline.xml

 < XML版本=1.0编码=UTF-8&GT?;
 <形状的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
   机器人:形状=行>

     <中风
        机器人:dashWidth =20SP
        机器人:dashGap =20SP
        机器人:宽=2DP
         机器人:颜色=#FF0000/>

     < /形状>
 

这是我的 XML 文件

 < ImageView的
    机器人:ID =@ + ID /按钮1
    机器人:layout_width =FILL_PARENT
    机器人:layout_height =6DP
    机器人:背景=@可绘制/ dash_line/>
 

解决方案

设置安卓layerType =软件为您ImageView的。检查文档为Android:layerType

When iam useing android doted line it working fine in Small screens, but not working in Samsung s3 device and higher versions am using this code.....

these are screenshots;

And

This is code am using.....

drawable/dashline.xml

<?xml version="1.0" encoding="utf-8"?>
 <shape xmlns:android="http://schemas.android.com/apk/res/android"
   android:shape="line" >

     <stroke
        android:dashWidth="20sp"
        android:dashGap="20sp"
        android:width="2dp"
         android:color="#FF0000" />

     </shape>

This is my XML file

 <ImageView
    android:id="@+id/button1"
    android:layout_width="fill_parent"
    android:layout_height="6dp"
    android:background="@drawable/dash_line" />   

解决方案

set android:layerType="software" for your imageView. Check the docs for android:layerType.

这篇关于Android的虚线/点线的问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆