我试图在自定义ListView中显示我的新闻.每个新闻都包括一些图像,我想
1. 从服务器下载图像
2.在本地存储中保存
3.save 路径的图像成的SQLite
4. 使用我的自定义适配器在ListView中显示图像.
我刚刚遇到第1步和第2步的问题.我可以从服务器获取新闻并在我的ListView中显示它们
并通过在我的适配器中添加以下代码来显示缓存中的图像:
Picasso.with(context).load(image[position]).into(iv);
Run Code Online (Sandbox Code Playgroud)
通过使用Picasso.with(context).load(image[position]).into(target),我可以保存一个
存储中的图像.
请建议我你的想法......
更新:当我使用下面的代码时,只保存一个图像(我的图像数组的最后一个索引)!
如何使用此代码保存数组中的所有图像?!
@Override
protected void onPostExecute(Void result) {
SaveImages();
pDialog.dismiss();
super.onPostExecute(result);
}
String fileName = null;
public void SaveImages() {
for(int i = 0; i < image.length; i++) {
Picasso.with(this).load(image[i]).into(target);
fileName = "image-" + i + ".jpg"; …Run Code Online (Sandbox Code Playgroud) 我将创建一个如下图所示的可绘制对象,其中包含一个箭头图像。

当我使用 layer-list 时,箭头图像出现在我的 drawable 中间!!!
请让我知道我怎样才能实现它......
更新:这是我的图层列表:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item >
<shape android:shape="rectangle">
<corners android:radius="5dp"/>
<solid android:color="#d5d5d5"/>
<stroke android:width="1dp" android:color="#242425"/>
</shape>
</item>
<item android:drawable="@drawable/ic_arrow"></item>
Run Code Online (Sandbox Code Playgroud)