Android中的虚线XML
我正在开发一个Android应用程序,我想在布局中使用虚线XML作为分隔符。对于这一点,我使用了不同的绘图方式,但不是画一条虚线,而是画一条线 我的提款表如下:Android中的虚线XML,android,line,dotted-line,Android,Line,Dotted Line,我正在开发一个Android应用程序,我想在布局中使用虚线XML作为分隔符。对于这一点,我使用了不同的绘图方式,但不是画一条虚线,而是画一条线 我的提款表如下: <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="line"> <stroke
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="line">
<stroke
android:color="#FF404040"
android:width="1dp"
android:dashGap="3dp"
android:dashWidth="1dp"
/>
<size
android:height="3dp"
/>
</shape>
因此添加
例如
<ImageView
android:layerType="software" // add here
...
或者像这样关闭硬件加速:
android:hardwareAccelerated="false"
也许这对你有帮助
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="line">
<stroke
android:color="#C7B299"
android:dashWidth="10px"
android:dashGap="10px" />
</shape>
请参考这个。。
试试这个
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="line">
<stroke
android:color="#FF404040"
android:width="5dp"
android:dashGap="10dp"
android:dashWidth="10dp"
/>
</shape>
使用下面的代码
谢谢您的回复。你能告诉我layerType可以放在哪里吗?你能在我的代码片段中显示出来吗。感谢可能的副本
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="line">
<stroke
android:color="#C7B299"
android:dashWidth="10px"
android:dashGap="10px" />
</shape>
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="line">
<stroke
android:color="#FF404040"
android:width="5dp"
android:dashGap="10dp"
android:dashWidth="10dp"
/>
</shape>
use Below code
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="90"
android:toDegrees="90" >
<shape android:shape="line" >
<stroke
android:width="1dp"
android:dashGap="6px"
android:dashWidth="6px"
android:color="#C7B299" />
</shape>
</rotate>