ActionbarSherlock主页按钮在版本下方无法访问

时间:2014-06-13 12:01:15

标签: java android eclipse actionbarsherlock

我正在使用actionbar sherlock和UriImageViewHelper库将图像设置为主页图标。

这是我的代码

ImageView view = (ImageView) getWindow().getDecorView().findViewById(android.R.id.home);//(ImageView) findViewById(android.R.id.home);
UrlImageViewHelper.setUrlDrawable(view, c.getString(c.getColumnIndex(DataProvider.COL_PICTURE_URL)), R.drawable.no_img);

它在3.0+手机上运行良好,但在旧版本上崩溃了view = null。

有什么工作吗?

1 个答案:

答案 0 :(得分:0)

那是因为android.R.id.home仅在3.0中引入。您必须找到ActionBarSherlock用来替换它的ID。很可能它会与com.actionbarsherlock.R.id.home类似,但我会让你自己探索一下。