- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 Picasso 库将图像加载到 ImageView 中,第一次它工作正常但之后如果我返回并进行一些更改再次启动带有图像的 Activity ,它会再次重复相同的图像。 url 始终相同,我已经搜索并应用了许多更改,但它不起作用,请帮忙。
同时,当我关闭应用程序并重新启动它时,它也没有得到刷新,当我在浏览器上点击 url 时,它会显示更新后的图像。
Picasso.with(this)
.load(Config.API_URL+"/sites/default/files/"+uiidd+".png")
.memoryPolicy(MemoryPolicy.NO_CACHE)
.networkPolicy(NetworkPolicy.NO_CACHE)
.into(imageView);
public class Activity_result extends AppCompatActivity {
Toolbar toolbar;
private ImageView imageView;
String uiidd;
Button testagain_btn;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_result);
imageView = (ImageView) findViewById(R.id.imageView_chart);
toolbar = (Toolbar) findViewById(R.id.tool_barresult);
testagain_btn=(Button)findViewById(R.id.btn_testagain);
setSupportActionBar(toolbar);
uiidd = MyApplication.getInstance().getUid();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
getWindow().setStatusBarColor(getResources().getColor(R.color.color_darkgreen));
}
Picasso.with(this)
.load(Config.API_URL+"/sites/default/files/"+uiidd+".png")
.into(imageView);
/* new Thread(new Runnable() {
@Override
public void run() {
Glide.get(Activity_result.this).clearDiskCache();
}
}).start();
Glide.with(this)
.load(Config.API_URL+"/sites/default/files/"+uiidd+".png")
.skipMemoryCache(true)
.diskCacheStrategy(DiskCacheStrategy.NONE)
//.signature(new StringSignature(System.currentTimeMillis()))
.into(imageView);*/
resultjsonrequest();
testagain_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
/* Intent i = new Intent(Activity_result.this,Activity_knowStatus.class);
startActivity(i);*/
final Dialog dialog = new Dialog(Activity_result.this);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.custom_dialoghealthdata);
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
ImageView dialogButtonCancel = (ImageView) dialog.findViewById(R.id.imageView_close);
Button dialogButtonOk = (Button) dialog.findViewById(R.id.btn_ok);
// Click cancel to dismiss android custom dialog box
dialogButtonCancel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dialog.dismiss();
}
});
// Your android custom dialog ok action
// Action for custom dialog ok button click
dialogButtonOk.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(Activity_result.this,Activity_knowStatus.class);
startActivity(i);
}
});
dialog.show();
}
});
}
@Override
protected void onResume() {
super.onResume();
Picasso.with(this)
.load(Config.API_URL+"/sites/default/files/"+uiidd+".png")
.into(imageView);
}
/* @Override
public void onBackPressed()
{
finish();
}*/
private void resultjsonrequest() {
Util.showProDialog(Activity_result.this,"Loading....");
JsonObjectRequest jsonObjReq = new JsonObjectRequest(Request.Method.GET,
Config.API_URL+"/profile-result-json?userProfileID="+uiidd+"", null, new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
try {
String txt_totalscore1 = response.getString("patient_score");
txtvw_totalscore.setText(txt_totalscore1);
String txt_chol1 = response.getString("Cholesterol");
txt_chol.setText(txt_chol1);
String cholcolor = response.getString("cholesterolPointColor");
linear_chol.setBackgroundColor(Color.parseColor(cholcolor));
String txt_trigly1 = response.getString("Triglycerides");
txt_trigly.setText(txt_trigly1);
String triglycolor = response.getString("triglycerideScoreColor");
linear_trigly.setBackgroundColor(Color.parseColor(triglycolor));
String txt_hdlchol1 = response.getString("HDLCholesterol %");
txt_hdl_chol.setText(txt_hdlchol1);
String hdlchl1color = response.getString("hDL_cholesterol_scoreColor");
linear_hdl_chol.setBackgroundColor(Color.parseColor(hdlchl1color));
String txt_sysbp1 = response.getString("SystolicBP");
txt_systolicbp.setText(txt_sysbp1);
String systoiccolor = response.getString("systolic_bp_scoreColor");
linear_systolicbp.setBackgroundColor(Color.parseColor(systoiccolor));
String txt_disys1 = response.getString("DiastolicBP");
txt_disystolicbp.setText(txt_disys1);
String disyscolor = response.getString("diastolic_bp_scoreColor");
linear_disystolicbp.setBackgroundColor(Color.parseColor(disyscolor));
String txsugarf1 = response.getString("Blood Sugar Fasting (FF)");
txt_bloodsugarff.setText(txsugarf1);
String sugarfcolor = response.getString("bl_glucode_ff_scoreColor");
linear_bloodsugarff.setBackgroundColor(Color.parseColor(sugarfcolor));
String txsugarp1 = response.getString("Blood Sugar (PP)");
txt_bloodsugarpp.setText(txsugarp1);
String sugarpcolor = response.getString("bl_glucose_pp_scoreColor");
linear_bloodsugarpp.setBackgroundColor(Color.parseColor(sugarpcolor));
String txsmoking1 = response.getString("Smoking");
txt_smoking.setText(txsmoking1);
String smokingcolor = response.getString("Smoking_ScoreColor");
linear_smoking.setBackgroundColor(Color.parseColor(smokingcolor));
String txbmi = response.getString("BMI");
txt_bmi.setText(txbmi);
String bmicolor = response.getString("BMI_ScoreColor");
linear_bmi.setBackgroundColor(Color.parseColor(bmicolor));
String txwalking1 = response.getString("Walking");
txt_walking.setText(txwalking1);
String walkingcolor = response.getString("walkingPointColor");
linear_walking.setBackgroundColor(Color.parseColor(walkingcolor));
String txt_oil1 = response.getString("Oil Intake");
txt_oil.setText(txt_oil1);
String oilcolor = response.getString("oil_ghee_intake_scoreColor");
linear_oil.setBackgroundColor(Color.parseColor(oilcolor));
String txmilk1 = response.getString("MilkDairy Intake");
txt_milk.setText(txmilk1);
String milkcolor = response.getString("milk_dairy_intake_scoreColor");
linear_milk.setBackgroundColor(Color.parseColor(milkcolor));
String txfruit1 = response.getString("Fruits Intake");
txt_fruit.setText(txfruit1);
String fruitcolor = response.getString("Vegitable_ScoreColor");
linear_fruit.setBackgroundColor(Color.parseColor(fruitcolor));
String txt_vegetable1 = response.getString("Vegetables Intake");
txt_vegetable.setText(txt_vegetable1);
String vegetablecolor = response.getString("vegetable_you_intake_scoreColor");
linear_vegetable.setBackgroundColor(Color.parseColor(vegetablecolor));
String txnonveg1 = response.getString("Animal Food");
txt_nonveg.setText(txnonveg1);
String nonvegcolor = response.getString("intake_non_veg_scoreColor");
linear_nonveg.setBackgroundColor(Color.parseColor(nonvegcolor));
String txyoga1 = response.getString("Yoga");
txt_yoga.setText(txyoga1);
String yogacolor = response.getString("yoga_or_stretching_exercis_scoreColor");
linear_yoga.setBackgroundColor(Color.parseColor(yogacolor));
String txmeditation1 = response.getString("MeditationPranayam");
txt_meditation.setText(txmeditation1);
String meditationcolor = response.getString("meditation_prayer_scoreColor");
linear_meditation.setBackgroundColor(Color.parseColor(meditationcolor));
String txstress1 = response.getString("Stress Management");
txt_stress.setText(txstress1);
String stresscolor = response.getString("stress_mgmt_scoreColor");
linear_stress.setBackgroundColor(Color.parseColor(stresscolor));
} catch (JSONException e) {
e.printStackTrace();
Util.showMessageDialog(Activity_result.this, "Server error! Try Again");
}
Util.dimissProDialog();
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Util.dimissProDialog();
Util.showMessageDialog(Activity_result.this, "Server error! Try Again");
}
});
jsonObjReq.setRetryPolicy(new DefaultRetryPolicy(
10000,
DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
// Adding request to request queue
// MyApplication.getInstance().addToRequestQueue(jsonObjReq);
RequestQueue requestQueue = Volley.newRequestQueue(this);
requestQueue.add(jsonObjReq);
}
}
最佳答案
我已经找到了上述问题的解决方案,问题的主要原因是与更新后的图片相同的网址,所以我每次都在带有随机生成数字的网址中添加一个 token ,因此网址被更改并且图片得到更新。
double token=0;
token=Math.random();
Picasso.with(getApplicationContext()).invalidate("");
Picasso.with(this)
.load(Config.API_URL+"/sites/default/files/"+uiidd+".png?"+token)
.memoryPolicy(MemoryPolicy.NO_CACHE)
.networkPolicy(NetworkPolicy.NO_CACHE)
.into(imageView_chartt);
关于android - picasso , ImageView 没有刷新,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40254833/
我正在尝试创建一个演示应用程序,我想在其中创建一个 ImageView ,该 ImageView 相互重叠,x 和 y 坐标略有变化(类似于所有纸牌相互重叠的任何纸牌游戏,但我们可以看到数字)。如果用
您好,我有一个要求,我需要通过拖动 ImageView 的右角来调整 ImageView 的大小和旋转 ImageView 。 我可以通过拖动 ImageView 的角成功地调整 ImageView
我目前正在尝试使用 JavaFX 在 ImageView 中居中图像。 所以我在 View 中加载图像: Image img = new Image("..."); imageView.setImag
我有一个非常简单的问题要问:我需要在屏幕右下角的 ImageView 上放一个小 Logo ,整个屏幕都很大,但我不知道如何设置坐标或如何设置说 ImageViews 处于相对位置。 像这样: 最佳答
我想像这样制作一个 ImageView 覆盖另一个 ImageView;只有一半的绿色圆圈覆盖了图像: 我试过使用 RelativeLayout 并将两个 ImageView 都放在里面。然后我使用
我们如何使 ImageView 的宽度和高度等于父 ConstraintLayout 的宽度?所以它显示一个全宽的方形 ImageView。 通常如何设置某个小部件的高度等于其他小部件的宽度? 最佳答
有点像刽子手 如果 ImageView 中有东西,如何跳过 ImageView 并检查其中是否有东西尝试检查 imageView 中是否有图像 代码 final boolean imageT
我正在用 swift 制作一种“保持在线条之间”iPhone 应用程序,我有一个移动 ImageView 和 2 个代表线条的 ImageView 。如何检测移动 ImageView 何时撞击或接触线
我正在做一个应用程序,用户通过单击图像(ImageView1)可以在另一个ImageView2中看到它。所以我尝试在变量中获取 ImageView1 的图像 BufferedImage img= Sw
我有以下看法: 如果我点击任何 ImageButton 以全屏模式显示相应的图像。例如,如果我点击 Black ,它会显示 ImageView ,如: 我还为一些图像按钮将背景设置为全屏颜色:如果我单
我在名为 DialButton2 的类中扩展了 ImageView 类(不要担心类的名称,它无关紧要)。 DialButton2 类所做的只是显示位于可绘制文件夹中的任 Intent 像。 packa
我正在使用 Xcode 8.1 和 swift 3.0 开发应用。 使用 Storyboard ,我扩展了一个 ImageView 以占据整个 View ,并为其设置了一张图片以用作背景图像(使用 s
如何将我的 imageView 裁剪成我在项目中有图像的气泡形状。 最佳答案 以下是调整大小或裁剪图像的简单代码,您只需根据需要为图像传递高度或宽度即可: 获取裁剪图像: UIImage *cropp
我有 92 张图像,我希望有一个指示符(例如复选标记)来指示图像已解锁。我在 .png 文件中有复选标记,我首先尝试的是为每个图像制作单独的副本,并将复选标记放在 Photoshop 中的图像顶部。但
我有两个 ImageView ,它们看起来像这样。我想将 TouchListener 添加到 imageview1。但听众无法正常工作。我正在将 imageview2 添加到 android:foc
我有一个列表布局,其中包含如下所示的项目: 首先有一个 ImageView(灯光),然后是两个 textView。所有这些都在 TableLayout 中。 (来源:http://code.googl
我想知道如何将 ImageView 元素添加到 JavaFx 2.1 中的区域元素。 也许我把这个元素的用法弄错了,但 AFAIK 它也是子元素的容器。 背景是我需要一个定义大小的区域,该区域应显示独
我在调整 StackPane 中的 ImageView 大小时遇到了问题:如果 StackPane 是根容器并且我将图像的高度和宽度绑定(bind)到 StackPane,那么一切都很好。
** 我有两个 ImageView ,一个用于背景,一个用于前景,我正在前景 ImageView 上绘图。对于删除功能,我这样做是因为我不想在删除时删除背景图像。它正在执行很好。现在我想保存该图像(背
我正在尝试为 watch 应用程序创建 ImageView ,我正在尝试以编程方式创建,但经典 View Controller 中使用的代码不起作用。 let imageName = "yourIma
我是一名优秀的程序员,十分优秀!