标签: picasso

使用毕加索调整图像大小

大家好,我遇到了毕加索的问题。我正在尝试从声音云加载图像,但它一直显得拉伸或非常小。这是我的 XML

        <ImageView
            android:id="@+id/album_cover_art"
            android:layout_width="300dp"
            android:layout_height="200dp"
            android:layout_alignParentTop="true"
            android:layout_centerHorizontal="true"
            android:layout_marginTop="@dimen/fragment_content_item_top_margin"
            android:scaleType="centerInside"
            android:contentDescription="@string/content_description_image_placeholder"
            android:src="@drawable/placeholder" />
Run Code Online (Sandbox Code Playgroud)

我尝试使用毕加索的调整大小和居中内部,但图像显得很小。

Picasso.with(getContext()).load(mSelectedTrack.getArtworkURL()).resize(800,300).centerInside().into(mAlbumCoverArt);
Run Code Online (Sandbox Code Playgroud)

使用毕加索的调整大小和中心裁剪可以保持图像视图大小,但会导致图像看起来被拉伸。

Picasso.with(getContext()).load(mSelectedTrack.getArtworkURL()).resize(800,300).centerCrop().into(mAlbumCoverArt);
Run Code Online (Sandbox Code Playgroud)

有什么想法可以比自己编写一个函数来调整大小更容易吗?

android image picasso

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

毕加索图像库缓存

我正在使用毕加索来显示图像.我需要时可以强制清除缓存吗?我用谷歌搜索,但我找不到任何解决方案.

谢谢.

android picasso

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

如何使用毕加索或通用图像加载器和列表视图

从互联网文本数据加载并链接到图像.我无法理解如何在listview中加载图像.阅读,它需要使用毕加索或通用图像加载器,但不明白如何.请更正我的代码

    public class JsonReadTask extends AsyncTask<String, Void, String> {

      @Override
      protected String doInBackground(String... params) {
       HttpClient httpclient = new DefaultHttpClient();
       HttpPost httppost = new HttpPost(params[0]);
       try {
        HttpResponse response = httpclient.execute(httppost);
        jsonResult = inputStreamToString(
          response.getEntity().getContent()).toString();
       }

       catch (ClientProtocolException e) {
        e.printStackTrace();
       } catch (IOException e) {
        e.printStackTrace();
       }
       return null;
      }

      private StringBuilder inputStreamToString(InputStream is) {
       String rLine = "";
       StringBuilder answer = new StringBuilder();
       BufferedReader rd = new BufferedReader(new InputStreamReader(is));

       try {
        while ((rLine = rd.readLine()) != null) { …
Run Code Online (Sandbox Code Playgroud)

android universal-image-loader picasso

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

如何将毕加索传递到ListView适配器

我需要将此行传递到列表适配器

Picasso.with(getActivity()).load(imageurl).into(imageOrders);
Run Code Online (Sandbox Code Playgroud)

清单

ListView list= (ListView) getActivity().findViewById(R.id.list);
ListAdapter adapter=new SimpleAdapter(getActivity(),orderList,R.layout.order_usa_row,
new String[]{TAG_PRICE,TAG_TITLE,TAG_PSTATUS,TAG_PRICESYMBOL,TAG_IMAGE},new int[]{R.id.price,R.id.title,R.id.pstatus,R.id.symbol,R.id.imageOrders});

list.setAdapter(adapter);
Run Code Online (Sandbox Code Playgroud)

我是一个初学者,我尝试了很多,但是我不知道如何解决,请帮助

android android-listview picasso

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

如何在上传到服务器之前使用Picasso调整图像大小?

我正在使用loopj上传图像.

params.put("file_"+key+"", new File(String.valueOf(value.getOriginalPath())));
Run Code Online (Sandbox Code Playgroud)

但我想在上传前调整图片大小.有没有办法"动态"调整图像大小 - 没有调整大小 - >保存到SD->上传?只调整内存和上传 - InputStream?

谢谢.

android image-uploading loopj picasso

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

Android的,毕加索.没有从网址加载图片

我刚开始使用Picasso来下载,存储和检索图像,但我在第一步就陷入困境.我写了最简单的代码,但它没有加载任何东西!这是代码:

    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Button b = (Button) findViewById(R.id.button1);
    final ImageView imageView = (ImageView) findViewById(R.id.imageView1);
    b.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View arg0) {
            Picasso.with(getApplicationContext()).load("http://www.farsnews.com/shares/img/PLogo.jpg").into(imageView);
        }
    });
}
Run Code Online (Sandbox Code Playgroud)

并且布局是:

<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"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" 
android:layout_gravity="center"
android:gravity="center">

<ImageView
    android:id="@+id/imageView1"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_alignParentTop="true"
    android:layout_centerHorizontal="true"
    android:src="@drawable/ic_launcher"
    tools:ignore="ContentDescription"/>

<Button
    android:id="@+id/button1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignBottom="@+id/imageView1"
    android:layout_centerHorizontal="true"
    android:layout_marginBottom="26dp"
    android:text="Button" />
Run Code Online (Sandbox Code Playgroud)

那么,为什么它不起作用?

使用Picasso lib下载,存储和检索图像真的是一个很好的选择吗?

android image picasso

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

毕加索是否支持图像磁盘缓存

在我使用Volley之前,我已经使用DiskLruCache [link] 和Volley将图像缓存在磁盘上.

现在我一直在使用正在使用Picasso的应用程序.

我想知道Picasso是否支持磁盘缓存.如果它支持我如何修复缓存大小.

使用磁盘缓存从远程加载图像时哪个有用?

android caching disk android-volley picasso

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

在AsyncTask中使用picasso加载图像

我正在使用毕加索来加载图像作为我的活动的背景,我想使用AsyncTask,而图像正在加载,完成后进度条会解散,以便为我的应用程序提供更好的外观,

这是我的代码:

  private class RemoteDataTask extends AsyncTask<Void, Void, Void> {
    @Override
    protected void onPreExecute() {
        super.onPreExecute();
        mProgressDialog = new ProgressDialog(MainActivity.this);
        mProgressDialog.setMessage("Chargement...");
        mProgressDialog.setIndeterminate(false);
        mProgressDialog.show();

    }

    @Override
    protected Void doInBackground(Void... params) {
           Picasso.with(MainActivity.this).load("http://tv2.orangeadd.com/mediacenter-data/ofc__bg_home.jpg").into(background,new com.squareup.picasso.Callback() {
                 @Override
                 public void onSuccess() {
               mProgressDialog.dismiss();
                 }

                 @Override
                 public void onError() {

                 }
             }); 
        return null;
    }
    @Override
    protected void onPostExecute(Void result) {





    }
    }
Run Code Online (Sandbox Code Playgroud)

这总是显示错误并强制我的应用程序退出!

多谢你们 :)

android android-asynctask picasso

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

毕加索导致任务执行失败':app:dexDebug'

我正在使用Android工作室,我正在尝试将Picasso库添加到我的项目中,但每当我尝试运行应用程序时,我都会遇到此错误

Error:Execution failed for task ':app:dexDebug'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/bin/java'' finished with non-zero exit value 2
Run Code Online (Sandbox Code Playgroud)

这是我的Gradle档案

apply plugin: 'com.android.application'

android {
compileSdkVersion 22
buildToolsVersion "22.0.0"

defaultConfig {
    applicationId "com.example"
    minSdkVersion 15
    targetSdkVersion 22
    versionCode 1
    versionName "1.0"
}

buildTypes {
    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.facebook.android:facebook-android-sdk:3.21.1'
//TODO::Update to the latest version of Play Service
compile 'com.google.android.gms:play-services:6.5.87'
compile 'com.lorentzos.swipecards:library:1.0.8'
compile …
Run Code Online (Sandbox Code Playgroud)

android android-studio build.gradle picasso android-gradle-plugin

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

使用 picasso 从 url 获取图像

我想从 url 加载图像并将其保存在 sd 卡中的文件中,然后从文件加载并显示在图像视图中。

所以我正在尝试使用毕加索加载图像。但它没有显示在图像视图上。

这是网址:

http://xesoftwares.co.in/contactsapi/profile_images/d34b638b93773140eb94d5f03c20237c.jpg

使用毕加索加载图像。

Picasso.with(MainActivity.this).load(url).into(profileImage);
Run Code Online (Sandbox Code Playgroud)

如何从url下载图片。将其保存在 sd 卡中的文件中,然后从文件中加载图像以显示在图像视图中?

请帮忙。谢谢..

url android image picasso

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