Recent Items used in the UI requires drawing a dotted line, the easiest course is to design cutting plans, direct introduction, but cut plan will screen adaptation problems stretching deformation, the loading force that can be used to achieve a custom control, but the price a little large, so the shape used here to achieve, simply make a record.
The figure is the effect achieved:
First part:
is seen by a border part which is relatively simple, the drawable create a new file dash_box.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- 线的宽度,颜色灰色 -->
<stroke
android:width="1.5px"
android:color="@color/c_e8"
android:dashGap="1dp"
android:dashWidth="4dp"/>
<!-- 矩形的圆角半径 -->
<corners android:radius="3dp"/>
</shape>
Then referenced in the layout file on OK:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="24dp"
android:background="@drawable/dash_box">
The second part is a vertical bar of the painting, a new shape_dash_line.xml file:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:left="-300dp"
android:right="-300dp">
<rotate
android:fromDegrees="90"
android:visible="true">
<shape android:shape="line">
<stroke
android:width="1.5px"
android:color="@color/c_e8"
android:dashWidth="4dp"
android:dashGap="1dp"/>
</shape>
</rotate>
</item>
</layer-list>
Then reference image resources in the layout:
<View
android:layout_width="1.5px"
android:layout_height="match_parent"
android:background="@drawable/shape_dash_line"
android:layerType="software"/>
PS:
Android: layerType = "Software" sentence must be added, otherwise see is a straight line;
Rotate label to achieve the common shape shift into a vertical line of.