I want to know is there a simple way to draw a line in diagonal direction, like using <View .... /View>
in xml to draw line in vertical or horizontal direction.
Below is the image of what I want to do
Selected form of button
Unselected form of button
Changing color of text is not a problem, its drawing line for unselected case and making invisible for selected one. Thank you
Create a transparent image with diagonal line and add that image as an overlay.
or create an shape xml of diagonal and add in your drawable. below is code to create diagonal shape.
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<rotate
android:fromDegrees="160"
android:pivotX="50%"
android:pivotY="50%"
android:toDegrees="0">
<shape
android:shape="line"
android:top="1dip">
<stroke
android:width="3dp"
android:color="#FF0000"/>
</shape>
</rotate>
</item>
</layer-list>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With