Reputation: 1854
I have searched quite a lot on it already here and have implemented the common solution. What I want is something like this (Red border around listview row items) :
What I am getting is this (red border only at the top is visible) :
Here is the implementation:
ListView.xml
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/gray"
android:paddingTop="1dp" >
<android.support.v4.widget.SwipeRefreshLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/swipe_container"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingRight="17dp"
android:paddingTop="5dp"
android:paddingLeft="17dp">
<ListView
android:id="@+id/lv_feeds"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="@android:color/transparent"
android:dividerHeight="5.0sp"
android:scrollbars="none">
</ListView>
</RelativeLayout>
</android.support.v4.widget.SwipeRefreshLayout>
</FrameLayout>
row_listview.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/border">
.....
</LinearLayout>
border.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/white" />
<stroke android:width="12dp" android:color="@color/app_red"/>
</shape>
Upvotes: 3
Views: 3900
Reputation: 615
After going through your code What I got is -
Upvotes: 0
Reputation: 3633
Give some padding left and right to Linear Layout:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/border"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingBottom="5dp">
.....
</LinearLayout>
Upvotes: 6