【发布时间】:2014-08-08 02:25:31
【问题描述】:
如何使用切换按钮启用或禁用在 web 视图中加载图像?我已经使用了这个代码,但图像是永久启用的。
toggle=(ToggleButton)findViewById(R.id.tglbtn1);
toggle.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
if(toggle.isChecked())
{
Toast.makeText(getApplicationContext(), "The state is changed to on", Toast.LENGTH_LONG).show();
webView.getSettings().setLoadsImagesAutomatically(true);// Enable Image
// Loading
}
else
{
Toast.makeText(getApplicationContext(), "The state is changed to off", Toast.LENGTH_LONG).show();
webView.getSettings().setLoadsImagesAutomatically(false);// Enable Image
// Loading
}
}
});
【问题讨论】: