recycleview 使用侧滑删除 android 6.0机型出现item抖动;列表一屏以上,点击后面的item(需要滚动查看了) 然后马上会往上滚动回首个item,滚回第一项
来源:互联网 发布:淘宝 安逸花支付 编辑:程序博客网 时间:2024/05/01 18:22
2016-8-17 10:07:05补充
recycleview 列表一屏以上,点击后面的item(需要滚动查看了) 然后马上会往上滚动回首个item
//个人理解是因为item的内容如果会改变view布局大小,使用这个方法防止布局重新,滚回第一项id_rv_left.setHasFixedSize(true);//位置固定大小
也许这也能解决下面之前这样解决的这个问题,没测试,我觉得应该行,供参考。
=========================分割线=============================
recycleview 使用侧滑删除 在滑动下面需要滚动才能看到的item时 刚滚动完的那时候去侧滑,出现item回到不可见的地方 但是侧滑是成功了 体验不好。。。
引起问题的写法
<?xml version="1.0" encoding="utf-8"?><RelativeLayout 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" tools:context="com.sunstar.cloudseeds.activity.PZAndJDManageActivity"> <include android:id="@+id/id_toolbar" layout="@layout/layout_toolbar"/> <RelativeLayout android:id="@+id/id_ll_id_et_search" android:layout_width="match_parent" android:layout_margin="10dp" android:layout_below="@id/id_toolbar" android:layout_marginRight="10dp" android:layout_height="wrap_content" android:focusable="true" android:focusableInTouchMode="true" > <EditText android:id="@+id/id_et_search" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="请输入搜索关键字" android:singleLine="true" android:ellipsize="end" android:layout_marginLeft="5dp" android:drawableLeft="@drawable/ic_search_green_800_36dp" /> <TextView android:id="@+id/id_tv_search_go" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" android:layout_alignParentRight="true" android:background="@drawable/ic_chevron_right_green_800_36dp" android:padding="10dp" /> </RelativeLayout> <android.support.v7.widget.RecyclerView android:id="@+id/id_rv" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@id/id_ll_id_et_search" > </android.support.v7.widget.RecyclerView></RelativeLayout>
改法1:(改成android:layout_height=”match_parent”)
<?xml version="1.0" encoding="utf-8"?><RelativeLayout 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" tools:context="com.sunstar.cloudseeds.activity.PZAndJDManageActivity"> <include android:id="@+id/id_toolbar" layout="@layout/layout_toolbar"/> <RelativeLayout android:id="@+id/id_ll_id_et_search" android:layout_width="match_parent" android:layout_margin="10dp" android:layout_below="@id/id_toolbar" android:layout_marginRight="10dp" android:layout_height="wrap_content" android:focusable="true" android:focusableInTouchMode="true" > <EditText android:id="@+id/id_et_search" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="请输入搜索关键字" android:singleLine="true" android:ellipsize="end" android:layout_marginLeft="5dp" android:drawableLeft="@drawable/ic_search_green_800_36dp" /> <TextView android:id="@+id/id_tv_search_go" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" android:layout_alignParentRight="true" android:background="@drawable/ic_chevron_right_green_800_36dp" android:padding="10dp" /> </RelativeLayout> <android.support.v7.widget.RecyclerView android:id="@+id/id_rv" android:layout_width="match_parent"android:layout_height="match_parent"==================================== android:layout_below="@id/id_ll_id_et_search" > </android.support.v7.widget.RecyclerView></RelativeLayout>
改法2:(改成LinearLayout)
<?xml version="1.0" encoding="utf-8"?><LinearLayout 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:orientation="vertical" tools:context="com.sunstar.cloudseeds.activity.PZAndJDManageActivity"> <include android:id="@+id/id_toolbar" layout="@layout/layout_toolbar"/> <RelativeLayout android:id="@+id/id_ll_id_et_search" android:layout_width="match_parent" android:layout_margin="10dp" android:layout_below="@id/id_toolbar" android:layout_marginRight="10dp" android:layout_height="wrap_content" android:focusable="true" android:focusableInTouchMode="true" > <EditText android:id="@+id/id_et_search" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="请输入搜索关键字" android:singleLine="true" android:ellipsize="end" android:layout_marginLeft="5dp" android:drawableLeft="@drawable/ic_search_green_800_36dp" /> <TextView android:id="@+id/id_tv_search_go" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" android:layout_alignParentRight="true" android:background="@drawable/ic_chevron_right_green_800_36dp" android:padding="10dp" /> </RelativeLayout> <android.support.v7.widget.RecyclerView android:id="@+id/id_rv" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@id/id_ll_id_et_search" > </android.support.v7.widget.RecyclerView></LinearLayout>
1 0
- recycleview 使用侧滑删除 android 6.0机型出现item抖动;列表一屏以上,点击后面的item(需要滚动查看了) 然后马上会往上滚动回首个item,滚回第一项
- RecycleView 列表的item点击事件
- Android实现一个选择器-recycleview滚动中第一个item位置的获取
- Android-RecycleView的item点击事件
- RecycleView的Item点击事件
- android项目从零开始 RecycleView 设置滚动到某item时间
- 一般情况下ListView中的 item点击事件和 item 中的Button按钮点击事件 同时需要时,就会出现Button抢占了item的焦距问题,导致ListView中的item点击事件无效,解决
- Universal-Image-Loader使用注意,Listview中加入SwipeLayout,删除某item的时候,会出现类似抖动的现象
- android ListView 滚动加载item
- RecycleView删除item问题
- RecycleView 删除指定item
- android listview ,recycleView item没有点击效果
- RecycleView的使用,并添加子item的点击事件
- RecycleView的不同类型Item点击事件
- RecycleView如何实现item的点击事件
- 利用RecycleView实现类似ListView的Item点击,长按等操作事件以及点击后每一项在添加一个列表
- android ListView的item侧滑删除
- 横向滚动的ListView并且点击item附带item的背景改变
- Network_toj1026_割点
- SpannableString 你应该知道的那些效果显示
- 本地电脑通过修改hosts文件实现域名本地解析
- oracle 建索引
- 蓝牙AmoMcu_254x传感器---光敏电阻的实现
- recycleview 使用侧滑删除 android 6.0机型出现item抖动;列表一屏以上,点击后面的item(需要滚动查看了) 然后马上会往上滚动回首个item,滚回第一项
- 大数据的仓库Hive原理(二)
- Android java.lang.UnsatisfiedLinkError 的问题
- 深入理解Java Proxy机制
- Linux的死锁检测
- iOS显示启动页时隐藏状态栏
- jfinal com.jfinal.plugin.activerecord.ActiveRecordException: The attribute name is not exists: id
- android 基础之配置文件
- Androidstudio的gradle过大内存溢出解决