首页 \ 问答 \ 如何在GridView中最好地优化Picasso?(How do I best optimize Picasso in a GridView?)

如何在GridView中最好地优化Picasso?(How do I best optimize Picasso in a GridView?)

我正在使用Picasso(2.5.2)通过适配器将本地content://图像加载到3列GridView

Picasso
    .with(mContext)
    .load(mCameraImages.getUris().get(position))
    .error(android.R.drawable.ic_dialog_alert)
    .fit()
    .centerCrop()
    .into(view);

在我的特定情况下, mCameraImages只是一个URI列表,来自本地mediaStore。

我发现当我加载GridView ,Picasso总是从磁盘(蓝色调试指示器)而不是内存中获取图像。

这是预期的,但我想通过更快地加载缩略图或图像来优化UX。

如果向下滚动GridView并且必须等待〜秒才能完成磁盘提取,那么“性能”特别差。

我可以尝试哪些方法来优化Picasso加载,以便本地内容可以像QuickPic一样快速显示?

这是我减少的适配器代码 (非常简单)。


I'm using Picasso (2.5.2) to load local content:// images into a 3-column GridView via an adapter.

Picasso
    .with(mContext)
    .load(mCameraImages.getUris().get(position))
    .error(android.R.drawable.ic_dialog_alert)
    .fit()
    .centerCrop()
    .into(view);

In my particular case, mCameraImages is a just a list of URIs, coming out of the local mediaStore.

I'm finding that when I load the GridView, Picasso always fetches the images from the disk (blue debug indicator) and not memory.

This is expected but I'd like to optimize the UX by loading thumbnails or images faster.

The "performance" is particular poor if you scroll the GridView down and have to wait for ~seconds for the disk fetch to complete.

What methods could I try to optimize Picasso loading so that local content can be displayed as quick as an app like QuickPic?

Here is my reduced adapter code (it is very simple).


原文:https://stackoverflow.com/questions/30496923
更新时间:2022-06-04 07:06

最满意答案

我不确定你的问题是否在试图说“如何让Spotlight找到文件?” 或“我想找到一个包含PIP_RESPECT的文件而我不在乎”。

如果是第二个,您可以从终端搜索Mac上的每个文件,如下所示:

sudo find / -type f -exec grep PIP_RESPECT {} /dev/null \; 2> /dev/null

运行需要一些时间! 它说...从文件系统的根目录(顶部)开始,找到所有文件(不是目录)并查看每个文件(使用grep)并查看是否可以找到PIP_RESPECT并打印文件名称你可以扔掉错误信息。

如果您只想在自己的登录目录及下面搜索,那么这样做会更快更容易(感谢@ I'L'I):

find  ~  -type f -exec ....

I am not sure from your question if you are trying to say "How do I make Spotlight find a file?" or "I want to find a file containing PIP_RESPECT and I don't care how".

If the second, you can search through every file on your Mac from the terminal like this:

sudo find / -type f -exec grep PIP_RESPECT {} /dev/null \; 2> /dev/null

It will take some time to run! It says... starting at the root (top) of the filesystem, find everything that is a file (not directory) and look in every file (with grep) and see if you can find PIP_RESPECT and print the name of the file if you can and throw away error messages.

If you only want to search in your own login directory and below, it will be quicker and easier to do this (thanks to @I'L'I):

find  ~  -type f -exec ....

相关问答

更多
  • 我知道,这个线程是老的,但问题不是。 这是一个解决方案,我已经找到了启用全球终端的颜色 。 编辑您的.bash_profile (自OS X 10.8) - 或(10.7及更早版本) .profile /etc/profile或.bashrc或/etc/profile (取决于可用性) - 在您的主目录中,并添加以下代码: export CLICOLOR=1 export LSCOLORS=GxFxCxDxBxegedabagaced CLICOLOR=1只能使您的终端着色。 LSCOLORS=...指定 ...
  • 这是一个可怕的黑客攻击,并不适用于所有情况。 tmp=${stringZ%%C12*} # Remove the search string and everything after it echo $(( ${#tmp} + 1 )) # Add one to the length of the remaining prefix This is a horrible hack, and may not work for all cases. tmp=${stringZ%%C12*} # ...
  • 您正在查看的示例代码完全取决于Windows,使用C:\blah路径。 OS X上的等效路径如下所示: /Users/yourusername/Documents (在转换代码时,你似乎也以某种方式改变了一些东西。不确定那是什么。) The example code you're looking at is totally Windows specific, what with the C:\blah paths. An equivalent path on OS X would look somethi ...
  • 听起来像NSLocalizedString的工作。 您可以在法语本地化中添加一个条目(在Localizable.strings中): "bytes" = "octets"; "KB" = "Ko"; "MB" = "Mo"; "GB" = "Go"; 然后使用: return [NSString stringWithFormat:@"%i %@", theSize, NSLocalizedString(@"bytes", nil)]; 为了更具体地回答这个问题,我不知道有任何Cocoa函数可以处理这些转 ...
  • 直到大约两年前,我们有一个开发人员在OSX工作,并且当我们在他的环境中破坏某些东西时,他会友好地指出。 从那以后我们还没有真正尝试过。 我们监视文件的两个位置是在运行时更改授权。 这些功能仍然有效,他们只是不会在运行时更新状态。 我不知道我们使用的任何其他库会阻止您在OSX中工作。 Up until about two years ago we had a developer who was working in OSX and would kindly point out whenever we brok ...
  • 有几个配置文件可用于在OS X中设置PYTHONPATH : 第一个是配置文件,位于hidden / private / etc /文件夹中: /private/etc/profile 您可以使用以下语法在那里设置变量: export MY_CUSTOM_ENV_VARIABLE="/Applications/MyApp/bin" 其他配置文件是.cshrc , .bashrc和. bash_profile . bash_profile (感谢albert为您的信息)位于用户的主目录中,并且基于您的操作 ...
  • 我不确定你的问题是否在试图说“如何让Spotlight找到文件?” 或“我想找到一个包含PIP_RESPECT的文件而我不在乎”。 如果是第二个,您可以从终端搜索Mac上的每个文件,如下所示: sudo find / -type f -exec grep PIP_RESPECT {} /dev/null \; 2> /dev/null 运行需要一些时间! 它说...从文件系统的根目录(顶部)开始,找到所有文件(不是目录)并查看每个文件(使用grep)并查看是否可以找到PIP_RESPECT并打印文件名称你 ...
  • 确保首先启动应用程序以使系统查看服务。 确保使用--setServicesProvider在应用程序中注册服务处理程序: 另外,请检查控制台日志,因为这可能会为您提供一些有用的错误信息。 Make sure you are launching your app first to get the system to see the Service. Make sure you are registering the services handler in your app using - setService ...
  • 你是open的正确的轨道; 要使用⌘ + F (我假设您的标签上有OS X),您可以使用AppleScript告诉System Events应用程序执行击键: os.system("open " + filename) # You may need to add a sleep() here if the application is not already open and therefore needs time to load os.system("""osascript -e 'tell appl ...
  • 在Lion和Mountain Lion上,磁盘工具UI中没有非日志的HFS变体。 如果您确实需要非日志卷,可以使用命令行diskutil工具。 您还可以在格式化卷后关闭日记功能; 在“磁盘工具”中选择它,按“选项”并单击“文件”菜单,然后选择“禁用日记功能”。 On Lion and Mountain Lion, the non-journaled HFS variants are not available in the Disk Utility UI. If you really need a non- ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)