stu*_*d91 3 android android-listview
我已经在这里搜索了很多,并实现了常见的解决方案.我想要的是这样的(listview行项目周围的红色边框):

我得到的是这个(只有顶部的红色边框可见):

这是实施:
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>
Run Code Online (Sandbox Code Playgroud)
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>
Run Code Online (Sandbox Code Playgroud)
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>
Run Code Online (Sandbox Code Playgroud)
在线性布局中左右填充一些填充:
<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>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3102 次 |
| 最近记录: |