3

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>
ƒernando Valle
  • 3,415
  • 6
  • 33
  • 55
  • Check and try solutions from [this topic](http://stackoverflow.com/questions/2658772/android-vertical-line-xml). – mmBs Apr 26 '13 at 10:15

1 Answers1

29

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" />
Jared Burrows
  • 50,718
  • 22
  • 143
  • 180
Celta
  • 3,275
  • 3
  • 18
  • 22
  • It+s a View, you have to align it with a android:layout_alignParentTop="true" or other like this one – Celta Apr 26 '13 at 10:24
  • But this dont show the same effect but in vertical, I have in top a gray bar and in bootom white bar, and I want at the left the gray bar and right white bar. Im checking with rotate: http://stackoverflow.com/questions/2658772/android-vertical-line-xml – ƒernando Valle Apr 26 '13 at 10:28
  • 1
    use the xml vertical i give you with android:layout_alignParentLeft="true" or android:layout_alignParentRight="true" – Celta Apr 26 '13 at 10:33