标签: picasso

适合 ReyclerView 项目中 imageView 的图像宽度

我目前可以使用此代码。我正在做的是使用 Picasso 下载图像并将其加载到 imageView 中,该 imageView 位于 RecyclerView 项内。

回收者项目 XML

<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/card_item"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:cardPreventCornerOverlap="false"
    app:cardElevation="4dp"
    app:cardCornerRadius="4dp"
    app:cardUseCompatPadding="true">

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <!-- Loading View -->
        <com.wang.avi.AVLoadingIndicatorView
            android:id="@+id/avloadingitem"
            android:layout_width="50dp"
            android:layout_height="50dp"
            android:layout_gravity="center"
            android:visibility="gone"
            app:indicator="BallClipRotate"
            app:indicator_color="@color/colorAccent"/>

        <!-- Imagen -->
        <com.wallakoala.wallakoala.Views.ProductImageView
            android:id="@+id/grid_image"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:riv_corner_radius_bottom_left="4dp"
            app:riv_corner_radius_bottom_right="4dp"
            app:riv_corner_radius_top_left="4dp"
            app:riv_corner_radius_top_right="4dp"/>

        <!-- Pie de foto -->
        <RelativeLayout
            android:id="@+id/footer"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="bottom"
            android:alpha="0.75">

            <!-- Info extra -->
            <include android:id="@+id/extraInfo"
                layout="@layout/product_footer_extra"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:visibility="visible"/>

            <!-- Info principal -->
            <include android:id="@+id/mainFooter"
                layout="@layout/product_footer"
                android:layout_height="@dimen/footer_height"
                android:layout_width="match_parent" …
Run Code Online (Sandbox Code Playgroud)

android image imageview picasso android-recyclerview

0
推荐指数
1
解决办法
5494
查看次数

Picasso 不会从 API 28 中的 HTTP 链接加载图像

所以我最近遇到了一个问题,只有来自 HTTPS 链接的图像才能成功加载,而所有其他图像都不能。这发生在我切换到 API 28 时。它在 28 之前从未这样做过。它在无法加载的所有图像上静默失败,或者只说“无法满足的请求”。这是版本2.71828

android image http picasso

0
推荐指数
1
解决办法
1083
查看次数

使用 Picasso 在 Kotlin 中获取目标空错误消息

我正在尝试使用 Json API 显示图像,但我收到 Target not null 错误消息。我有三个类,一个主要类,适配器类和模型类。我已经添加了 picasso 库,名称工作正常,没有问题,图像也有问题。任何帮助表示赞赏。

主要类:

var Test:String=catObj.getString("Test")
category.Test=Test
Picasso.get().load(category.Test).into(TestImage)---TestImage is my ImageView ID.
Run Code Online (Sandbox Code Playgroud)

适配器类:

class ViewHolder(itemView:View):RecyclerView.ViewHolder(itemView) {

    fun bindItem(Test:TestModel)
    {
        var name:TextView=itemView.findViewById<TextView>(R.id.CatName)
        var picture:TextView=itemView.findViewById<TextView>(R.id.CatImage)
        name.text=Test.name
        picture.text=Test.location

    }
}
Run Code Online (Sandbox Code Playgroud)

错误日志:

  java.lang.IllegalArgumentException: Target must not be null.
Run Code Online (Sandbox Code Playgroud)

android kotlin android-studio picasso

0
推荐指数
1
解决办法
1901
查看次数

使用 Picasso 库时无法解析方法 get()

当我尝试使用 Picasso 库时,我收到一条错误消息,提示“无法解析方法 get()”。这可能是什么原因?

我已经根据堆栈溢出上此类问题给出的答案尝试了一些解决方案,但它没有解决我的问题。

这是我的依赖:

dependencies {
 implementation 'com.squareup.picasso:picasso:2.5.2'
}
Run Code Online (Sandbox Code Playgroud)

这是我的 Java 代码,它抛出错误“无法解析方法 get()”:

dependencies {
 implementation 'com.squareup.picasso:picasso:2.5.2'
}
Run Code Online (Sandbox Code Playgroud)

java picasso

0
推荐指数
1
解决办法
2455
查看次数

指定为非空的参数为空 - 在 Kotlin 中加载图像

我正在使用 Picassos Target 从 Internet 加载图像并从中生成调色板。当图像不再存在时,我会因 Logcat 中的错误而崩溃:

 java.lang.IllegalArgumentException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkParameterIsNotNull, parameter placeHolderDrawable
        at .ActivityThread.performLaunchActivity(ActivityThread.java:3260)
        at .ActivityThread.handleLaunchActivity(ActivityThread.java:3396)
        at .servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
        at .servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
        at .servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
        at .ActivityThread$H.handleMessage(ActivityThread.java:2009)
        at .Handler.dispatchMessage(Handler.java:107)
        at .Looper.loop(Looper.java:214)
        at .ActivityThread.main(ActivityThread.java:7319)
        at .reflect.Method.invoke(Native Method)
        at .os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
        at .os.ZygoteInit.main(ZygoteInit.java:934)
     Caused by: java.lang.IllegalArgumentException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkParameterIsNotNull, parameter placeHolderDrawable
        at .LoadImage$onCreate$1.onPrepareLoad(Unknown Source:2)
        at com.squareup.picasso.RequestCreator.into(RequestCreator.java:559)
        at .LoadImage.onCreate(LoadImage.kt:154)
        **at .LoadImage.onCreate(LoadImage.kt:154)**
Run Code Online (Sandbox Code Playgroud)

好的,我明白发生了什么 - Picasso 加载图像,图像为空,因此应用程序崩溃。但是我怎样才能用一行代码来处理这个问题呢?

这是发生问题的部分,我为您标记了第 154 行:

    Picasso.get()
            .load(eventimgurl)
            **.into(object : com.squareup.picasso.Target {**
                override …
Run Code Online (Sandbox Code Playgroud)

android nullable illegalargumentexception kotlin picasso

0
推荐指数
1
解决办法
1044
查看次数

毕加索主要错误

我正在尝试使用Picasso Android库,但我无法让它工作.

首先,我正在尝试最简单的事情:

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_basic_view);

    mImageView = (ImageView) findViewById(R.id.imageView);
    Picasso.with(this).setIndicatorsEnabled(true);
    Picasso.with(this).setLoggingEnabled(true);
    Picasso.with(this).load("http://i.imgur.com/DvpvklR.png").into(mImageView);
}
Run Code Online (Sandbox Code Playgroud)

活动布局是:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<ImageView
    android:id="@+id/imageView"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="#FF0000"/>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

视图保持完全红色.如果我通过setImageResource在视图中设置资源,它会正确显示.

出现问题的唯一相关线索是:

毕加索:主要是错误的

但我不明白为什么.

我很乐意粘贴更多的logcat输出,但它会破坏代码块并变得不可读.

这是一个pastebin:主要错误日志

我相信我做错了一些微不足道的事情.

android picasso

-1
推荐指数
1
解决办法
669
查看次数

Android - MultiDexEnable = true导致Picasso崩溃

我在gradle文件中使用了MultiDexEnable = true命令来集成cometChat sdk.但是运行正常的Picasso库正在崩溃,现在出现以下错误.你能指导解决方案吗?

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"
    useLibrary 'org.apache.http.legacy'

    defaultConfig {
        applicationId "com.edesign.astutesol.eyesapp"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
            multiDexEnabled true

    }
    /*repositories {
        maven {
            url 'https://repo1.maven.org/maven2/'
           // url 'https://oss.sonatype.org/content/repositories/snapshots/'
        }
    }*/
    dexOptions {
        javaMaxHeapSize "4g"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'

    /*compile('org.apache.httpcomponents:httpmime:4.3.6') {
        exclude module: 'httpclient'
    }
    compile 'org.apache.httpcomponents:httpclient-android:4.3.5'*/
    /*compile 'com.loopj.android:android-async-http:1.4.9'*/
    /*compile 'com.loopj.android:android-async-http:1.4.9-SNAPSHOT'*/
    compile …
Run Code Online (Sandbox Code Playgroud)

android noclassdeffounderror cometserver picasso

-1
推荐指数
1
解决办法
792
查看次数

为什么我要旋转图像?

在我的应用程序中,我需要从相机加载图像。

这是我使用的代码:

private void openCamera()
{
    mMediaUri =getOutputMediaFileUri(MEDIA_TYPE_IMAGE);

    Intent photoIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
    photoIntent.putExtra(MediaStore.EXTRA_OUTPUT, mMediaUri);
    startActivityForResult(photoIntent, REQUEST_TAKE_PHOTO);


}


private Uri getOutputMediaFileUri(int mediaTypeImage)
{
    //check for external storage
    if(isExternalStorageAvaiable())
    {
        File mediaStorageDir = getActivity().getExternalFilesDir(Environment.DIRECTORY_PICTURES);

        String fileName = "";
        String fileType = "";
        String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new java.util.Date());

        fileName = "IMG_"+timeStamp;
        fileType = ".jpg";

        File mediaFile;
        try
        {
            mediaFile = File.createTempFile(fileName,fileType,mediaStorageDir);
            Log.i("st","File: "+Uri.fromFile(mediaFile));
        }
        catch (IOException e)
        {
            e.printStackTrace();
            Log.i("St","Error creating file: " + mediaStorageDir.getAbsolutePath() +fileName +fileType);
            return null;
        }
        return …
Run Code Online (Sandbox Code Playgroud)

android picasso

-1
推荐指数
1
解决办法
537
查看次数

Android Studio Picasso表示无法解析“加载”

所以我是android编程的新手。我正在尝试学习它,以便可以在大学项目中工作,该项目是在线食品订购应用程序。因此,作为新手,我指的是此视频教程-https ://www.youtube.com/watch?v= Ad41Bh704ms&list = PLaoF-xhnnrRW4lXuIhNLhgVuYkIlF852V

上传者使用的是Android Studio版本2.3.3,而我使用的是Android Studio 3.3.1。因此,我知道这里和那里的更改很少。现在,我被困在那版毕加索的变化中。

我已经使用了准确的代码组作为他,但是对我来说,它在“加载”时出错,请在 此处输入图片描述

这就是它的意思- 在此处输入图片描述

我已经在build.gradle中将此版本的毕加索添加为依赖项。 在这里输入图像描述 有人可以在这里帮助我吗?什么可能会触发“加载”中的错误,我该如何解决?提前致谢

android picasso

-4
推荐指数
1
解决办法
105
查看次数

-6
推荐指数
4
解决办法
3万
查看次数