这是我的代码:
private void setWeatherDialogInfoAndIcons(){
WeatherGoogle weather = WeatherGoogle.getInstance("istanbul");
String iconsPath = Environment.getExternalStorageDirectory().getAbsolutePath()+"/arla/images/hava/";
String[] allData = weather.getCityData().split("<>");
currentImage = (ImageView) customDialog.findViewById(R.id.imageViewcurrentWeatherImage );
currentInfo = (TextView) customDialog.findViewById( R.id.textViewCurrentInfo ) ;
currentInfo.setText( allData[0] +"\n"+allData[1]+"\n"+allData[2]+"\n"+allData[3] );
currentImage.setBackgroundResource(R.drawable.air);
currentImage.setBackgroundDrawable( UiHelper.getDrawableFromSdcard(iconsPath + weather.getIconName(0)) );
int j = 4;
for (int i = 0; i < dayInfos.size() ; i++) {
dayInfos.get(i).setText( allData[j] +"\nMin : "+ allData[j+1] +"\nMaks: "+ allData[j+2]
+ "\n" + allData[j+3] );
j+=4;
}
}
我可以更改 textviews 的文本,但是当我想设置 imageviev(currentImage) 的背景时它不起作用,它显示对话框但Imageview中没有背景。
currentImage.setBackgroundDrawable( UiHelper.getDrawableFromSdcard(iconsPath + weather.getIconName(0)) );
我确信我的方法getDrawableFromSdcard有效,因为我在代码中的其他地方使用了它最后我检查了 png 图标及其路径。那么可能是什么问题?