Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How build a vertical divider

I have the following divider and I wanted do the same effect but in vertical. How could I do this?

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:bottom="2dp">
        <shape android:shape="rectangle">
            <gradient
                android:startColor="#0fffffff"
                android:centerColor="#ff696969"
                android:endColor="#0fffffff"
                android:angle="90"></gradient>
            <size android:height="2dp"></size>
        </shape>
    </item>
    <item android:top="2dp">
        <shape android:shape="rectangle">
            <solid android:color="#ffffff"></solid>
            <size android:height="1dp"></size>
        </shape>
    </item>
</layer-list>

I get the solution with the help of Celta, I didnt use the divider xml and build my own lLinearLayout:

  <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="horizontal">
            <View
            android:layout_width="1dp"
            android:layout_height="fill_parent" 
            android:layout_alignParentLeft="true"
            android:background="#ff696969"></View>
                            <View
            android:layout_width="2dp"
            android:layout_height="fill_parent" 
            android:layout_alignParentLeft="true"
            android:background="#ffffff"></View>
</LinearLayout>
like image 540
ƒernando Valle Avatar asked Nov 28 '22 09:11

ƒernando Valle


1 Answers

You can use a View

Horizontal:

<View
    android:layout_width="fill_parent"
    android:layout_height="1dp"
    android:background="@android:color/holo_blue_light" />

Vertical:

<View
    android:layout_width="1dp"
    android:layout_height="fill_parent"
    android:background="@android:color/holo_blue_light" />
like image 95
Celta Avatar answered Jan 11 '23 17:01

Celta