我在第二个选项卡的活动上的create方法中执行此操作
public void infoTabs(){
//tab1: it works well
.......
// tab 2:
image.setImageResource(panel.getPhoto());
String infoCasilla = panel.getInfoText();
informacionCasilla.setText(infoCasilla);
}然后,当我按下第二个选项卡,它需要3-4秒来加载图像和文本,并锁定显示此内容选项卡。你能想出任何办法来防止它在那几秒钟被屏蔽吗?非常感谢。
发布于 2015-07-08 04:36:30
如果你的照片很大,将图片加载到imageButton(或ImageView,不管你用什么)可能需要很长时间(即3-4秒)。你应该在worker(后台)线程中加载它,而不是在UI线程中(就像你现在这样做)。所以使用单独的线程,如下所示:
new Thread(new Runnable() {
public void run() {
image.post(new Runnable(){
public void run() {
image.setImageResource(panel.getPhoto());
}
}
}
}).start(); https://stackoverflow.com/questions/31278629
复制相似问题