'How can I have a diagonal line, from corner to corner, with line width in dp unit?

Currently, this is the technique I am using, to have a diagonal line, from corner to corner.

layout.xml

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/color_container"
    android:layout_width="fill_parent"
    android:layout_height="56dp">

    <LinearLayout
        android:clickable="true"
        android:background="?attr/smartColorSelector"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="horizontal">
        <TextView
            android:paddingStart="0dp"
            android:paddingLeft="0dp"
            android:paddingEnd="8dp"
            android:paddingRight="8dp"

            android:textSize="18sp"
            android:id="@+id/text_view"
            android:layout_width="0dp"
            android:width="0dp"
            android:layout_weight="1"
            android:layout_height="match_parent"
            android:gravity="center_vertical|end"
            android:textColor="?attr/primaryTextColor"/>
    </LinearLayout>

    <View
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@drawable/diagonal_line" />

</FrameLayout>

diagonal_line.xml

<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:height="64dp"
    android:width="64dp"
    android:viewportHeight="600"
    android:viewportWidth="600" >

    <path
        android:name="diagonal_line"
        android:strokeColor="@color/colorPickerBorderColorLight"
        android:strokeWidth="16"
        android:pathData="M600, 0 l-600, 600z" />
</vector>

Here's the outcome.

enter image description here

The problem with such technique is, there is no way for me, to specific the diagonal line width, in dp unit! I would like to specific the diagonal line in dp unit.

May I know, what else good technique I can use, to achieve

a diagonal line, from corner to corner, with line width in dp unit?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source