android 画竖虚线

参考:http://blog.csdn.net/zhao2017/article/details/73866460

1.在Android中写横虚线比较简单,写竖虚线的话稍微麻烦点: 
需要将写的虚线旋转: 
这里面旋转角度设置为90 到90。

<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:color="#ebebeb" android:dashGap="1dp" android:dashWidth="2dp" /> <size android:width="200dp" android:height="3dp"></size> </shape> </rotate>
  •  

然后在用的地方可以将View的宽度设置的很大,以免周边的View影响其显示。

竖虚线在实际中用到的地方。

  <View
            android:id="@+id/view"
            android:layout_width="100dp" android:layerType="software" android:layout_height="match_parent" android:layout_marginLeft="-40dp" android:layout_marginRight="-10dp" android:layout_toRightOf="@id/tv_number" android:background="@drawable/main_red_pck_dash_line" > </View>
  •   

 

转载于:https://www.cnblogs.com/manmanlu/p/8318611.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值