Rex*_*ode 1 android android-recyclerview
我正在尝试RecyclerView使用不同的列表项来实现.我不知道为什么但是列表项目有一个阴影.当我向上和向下滚动时会出现这个阴影.我想摆脱这个阴影,但没有找到任何可以帮助我的东西.有什么建议?这是我的XML:
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="com.example.admin.lanet_contactwork.activities.LoginActivity">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:fitsSystemWindows="true"
android:layout_height="?attr/actionBarSize"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay"
app:layout_scrollFlags="scroll|enterAlways"/>
</android.support.design.widget.AppBarLayout>
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
/>
</android.support.design.widget.CoordinatorLayout>
Run Code Online (Sandbox Code Playgroud)
-------------------------------------- 更新:添加项目布局 - ------ ---------------------
第一个项目布局
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:orientation="horizontal"
>
<TextView
android:id="@+id/divider_txt"
android:layout_width="match_parent"
android:layout_height="48dp"
android:padding="8dp"
android:maxLines="1"
android:textSize="18sp"
android:background="@color/lightgrey"
android:textColor="@android:color/black"
android:textStyle="bold">
</TextView>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
第二项项目布局
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/task"
android:layout_width="match_parent"
android:layout_height="62dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/task_type_img"
android:layout_marginRight="5dp"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:src="@mipmap/ic_sort_grey" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text"
android:id="@+id/address_txt"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_marginLeft="72dp"
android:textSize="16sp"
android:textColor="@android:color/black"
android:layout_marginTop="12dp"
android:layout_toLeftOf="@+id/task_type_img" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="10:00"
android:id="@+id/time_txt"
android:textSize="16sp"
android:textColor="@android:color/black"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="16dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text"
android:id="@+id/address_details_txt"
android:layout_marginLeft="72dp"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
android:layout_marginBottom="12dp"
android:textColor="@android:color/black"
android:textSize="14sp"
android:layout_toLeftOf="@+id/task_type_img" />
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
Moh*_*ker 25
将此添加到您的RecyclerView:
android:overScrollMode="never"
Run Code Online (Sandbox Code Playgroud)
这个对我有用
| 归档时间: |
|
| 查看次数: |
5796 次 |
| 最近记录: |