Android 磨损:无法解析图像参考
Android Wear: Cannot Resolve Image Reference
这里可能是个愚蠢的问题,但我刚开始在 Android 中编程,所以请多多包涵。
https://gist.github.com/gabrielemariotti/ca2d0a9f79b902b19a65
我正在关注此项目以在我的 Android Wear 应用程序上实现 GridViewPager。它工作正常,只有我尝试使用的背景图像没有显示。它只显示黑屏。
问题是这个 getBackground() 方法,尤其是 imageReference。
public ImageReference getBackground(int row, int col) {
SimplePage page = ((SimpleRow)mPages.get(row)).getPages(col);
return ImageReference.forDrawable(page.mBackgroundId);
}
教程显示应该返回图像引用,但是我收到构建错误,指出无法解析 ImageReference。那么我是否必须为 ImageReference 创建一个 class 或接口?或者你是否为图像本身设置了一个属性?
任何人都可以阐明这一点吗?
提前干杯。
从可穿戴设备支持库的 1.1 版开始(FragmentGridPagerAdapter is part of), the methods have changed quite a bit: they no longer use any sort of ImageReference
class - the new method, getBackgroundForPage,只需 returns 一个 Drawable
。
这里可能是个愚蠢的问题,但我刚开始在 Android 中编程,所以请多多包涵。
https://gist.github.com/gabrielemariotti/ca2d0a9f79b902b19a65
我正在关注此项目以在我的 Android Wear 应用程序上实现 GridViewPager。它工作正常,只有我尝试使用的背景图像没有显示。它只显示黑屏。
问题是这个 getBackground() 方法,尤其是 imageReference。
public ImageReference getBackground(int row, int col) {
SimplePage page = ((SimpleRow)mPages.get(row)).getPages(col);
return ImageReference.forDrawable(page.mBackgroundId);
}
教程显示应该返回图像引用,但是我收到构建错误,指出无法解析 ImageReference。那么我是否必须为 ImageReference 创建一个 class 或接口?或者你是否为图像本身设置了一个属性?
任何人都可以阐明这一点吗?
提前干杯。
从可穿戴设备支持库的 1.1 版开始(FragmentGridPagerAdapter is part of), the methods have changed quite a bit: they no longer use any sort of ImageReference
class - the new method, getBackgroundForPage,只需 returns 一个 Drawable
。