I have My Layout like below:
which work for me is
<view
android:layout_below="@+id/kaimla_number"
android:layout_width="match_parent"
android:layout_height="3dp"
android:background="@color/golden"></view>
You should use the new lightweight View Space
to draw dividers.
Your layout will load faster if you will use Space
instead of View
.
Horizontal divider:
<android.support.v4.widget.Space
android:layout_height="1dp"
android:layout_width="match_parent" />
Vertical divider:
<android.support.v4.widget.Space
android:layout_height="match_parent"
android:layout_width="1dp" />
You can also add a background:
<android.support.v4.widget.Space
android:layout_height="match_parent"
android:layout_width="1dp"
android:background="?android:attr/listDivider"/>
Usage example:
....
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="One"/>
<android.support.v4.widget.Space
android:layout_height="match_parent"
android:layout_width="1dp"
android:background="?android:attr/listDivider"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Two"/>
<android.support.v4.widget.Space
android:layout_height="match_parent"
android:layout_width="1dp"
android:background="?android:attr/listDivider"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Three"/>
....
In order to use Space
you should add the dependency in your build.gradle:
dependencies {
compile 'com.android.support:support-v4:22.1.+'
}
Documentation https://developer.android.com/reference/android/support/v4/widget/Space.html
You can put this view between your views to imitate the line
<View
android:layout_width="fill_parent"
android:layout_height="2dp"
android:background="#c0c0c0"/>