android - Gradient Lines between GridView -
i want line below image between gridview:
following have been tried.
gridview xml:
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <gridview android:id="@+id/gridhouseindex" android:layout_width="match_parent" android:layout_height="match_parent" android:listselector="@null" android:smoothscrollbar="true" android:stretchmode="columnwidth" android:numcolumns="2" android:verticalspacing="22dp"> </gridview>
adapter xml:
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" > <linearlayout android:layout_width="wrap_content" android:layout_height="match_parent" android:orientation="vertical" > <linearlayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" > <imageview android:id="@+id/imgviewhouseindex" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical|center_horizontal|center" android:layout_marginleft="20dp" android:adjustviewbounds="true" android:src="@drawable/univer" /> <textview android:id="@+id/txtviewhouseindex" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:text="textview" android:textsize="12sp" android:textstyle="bold" /> </linearlayout> <view android:layout_width="match_parent" android:layout_height="1dp" android:background="@drawable/grid_line" /> </linearlayout> <view android:layout_width="1dp" android:layout_height="match_parent" android:background="@drawable/grid_line" />
grid line xml:
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <stroke android:width="2dp" android:color="#b6a9a9" /> <gradient android:angle="90" android:endcolor="#b6a9a9" android:startcolor="#ffffff" /> <corners android:bottomleftradius="1dp" android:bottomrightradius="1dp" android:topleftradius="1dp" android:toprightradius="1dp" />
by using above code, getting following image:
can please tell me, going wrong or have exact output.
updated:
output getting.
for horizontal
lines: gradientbackground.xml
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:dither="true" android:shape="rectangle" > <gradient android:angle="180" android:centercolor="#000000" android:endcolor="#f6f6f6" android:startcolor="#f6f6f6" /> </shape>
layout
:
<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/scroll_container" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@android:color/white" android:splitmotionevents="false" > <view android:id="@+id/divider" android:layout_width="fill_parent" android:layout_height="1dp" android:layout_centervertical="true" android:background="@drawable/backgrad" /> </relativelayout>
for vertical
lines: gradientbackground.xml
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:dither="true" android:shape="rectangle" > <gradient android:angle="270" android:centercolor="#000000" android:endcolor="#f6f6f6" android:startcolor="#f6f6f6" /> </shape>
layout
:
<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/scroll_container" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@android:color/white" android:splitmotionevents="false" > <view android:id="@+id/divider" android:layout_width="1dp" android:layout_height="fill_parent" android:layout_centerhorizontal="true" android:background="@drawable/backgrad" /> </relativelayout>
i hope can out.
thanks.
Comments
Post a Comment