0

I can create a separator view like a pipe | with something like:

<View
        android:layout_width="1dp"
        android:layout_height="match_parent"
        android:layout_marginLeft="12dp"
        android:layout_marginRight="12dp"
        android:background="@color/black" />  

But how can I create a separator that is like / or \ i.e. a line that is not straight?

Jim
  • 18,826
  • 34
  • 135
  • 254

2 Answers2

1

You can use android:rotation attribute.

e.g.

<View
    android:layout_width="1dp"
    android:layout_height="match_parent"
    android:layout_marginLeft="12dp"
    android:layout_marginRight="12dp"
    android:rotation="45"
    android:background="@color/black" />  
pawegio
  • 1,722
  • 3
  • 17
  • 29
1

You can create custom drawable like below

<item>
    <rotate
        android:fromDegrees="45"
        android:toDegrees="45"
        android:pivotX="50%"
        android:pivotY="50%" >
        <shape
            android:shape="line"
            android:top="1dip" >
            <stroke
                android:width="1dip"
                android:color="#FF0000" />
        </shape>
    </rotate>
</item>

Source: https://stackoverflow.com/a/15239304/2179495

Community
  • 1
  • 1
wichnator
  • 71
  • 2