Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 毕加索在滚动后显示图像_Android_Picasso - Fatal编程技术网

Android 毕加索在滚动后显示图像

Android 毕加索在滚动后显示图像,android,picasso,Android,Picasso,我有一个搜索视图和回收视图,我共享xml代码 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <SearchView androi

我有一个
搜索视图
回收视图
,我共享xml代码

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
 <SearchView
            android:id="@+id/searchinput"
            android:layout_width="match_parent"
            android:background="#FFFFFF"
            android:searchIcon="@null"
            android:layout_height="wrap_content"
            android:layout_alignParentStart="true"
            android:layout_alignParentTop="true" />
    
        <android.support.v7.widget.RecyclerView
            android:id="@+id/recycler"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_below="@+id/searchinput"
            android:layout_alignParentStart="true" />
    
    </RelativeLayout>
我在这里通过jsoup从web上获取一个单独的线程中的图像url,并通过piccaso在recycler视图中显示它,它工作得很好,但只在我向下滚动一点时显示,我在
onbindviewholder()中将它与piccaso一起使用。

如何在不滚动的情况下显示图像,谢谢

单击搜索按钮时,向下滚动一点


更新:添加更多功能后,现在仅当键盘弹出时才会显示该功能

问题是我试图在线程内使用
notifydatasetchanged()
,因此我将活动传递给适配器并实现了以下功能:

activity.runOnUiThread(new Runnable() {
@Override
 public void run() {
 notifyDataSetChanged();
 }
 });

由于适配器项目被回收,在滚动或键盘打开时显示的图像可以添加整个适配器代码吗?请尝试在两种
if-else
条件下添加
notifyDataSetChanged
,或者在
if-else
条件下添加
(可能是错误在于您没有在else条件下使用NOTIFYDATASETCHANGE
)@VivekThummar我在线程中使用了NOTIFYDATASETCHANGE(),我认为这就是问题所在,好的,我会解决它,但为什么当键盘打开时会自动调用NOTIFYDATASETCHANGE()?
Picasso.get().load(images.get(position)).fit().networkPolicy(NetworkPolicy.NO_CACHE, NetworkPolicy.NO_STORE).centerInside().into(holder.imageView);
activity.runOnUiThread(new Runnable() {
@Override
 public void run() {
 notifyDataSetChanged();
 }
 });