tags:

views:

751

answers:

2

Hi,

I have followed the example in for the gradient dividers: http://www.connorgarvey.com/blog/?p=34

I have tried to draw a horizontal line at the BOTTOM of my linear layout.

Here is my linear layout file:

        <LinearLayout android:id="@+id/test" android:layout_width="fill_parent"
            android:layout_height="wrap_content>

<ImageView android:id="@+id/icon1"
    android:layout_width="32dip"
    android:layout_height="32dip"
/>

And I did add

<View
android:background="@drawable/black_white_gradient"
android:layout_width="fill_parent"
android:layout_height="1dp"
android:layout_above="@id/test"
/>

But i don't see any line at the top of the LinearLayout. And when I go to Hierarchy View and see he View (for the hort separator), the getWidth() is 0 while getHeight() is 1.

Can you please tell me what am I missing?

Thank you.

A: 

I think the orientation might be missing in the parent linearlayout view;

<LinearLayout android:orientation="vertical"

Or if you use RelativeLayout instead of LinearLayout, you can set 's layout_alignParentBottom;

<View android:layout_alignParentBottom="true"
hwii77
A: 

With the code you posted ,its perfectly fine.But the fact that the size is 1dp may not be showing it . increase the size or as you want only a line use this default line drawable from android

android:background="@android:drawable/divider_horizontal_bright" 
// this for white background only

I hope this will help you get what you want

HaKr