【发布时间】:2017-07-28 20:30:54
【问题描述】:
是否可以制作一个应用程序,从用户手机的图库中拍摄照片并将其转换为安卓可穿戴表盘?
我一直在阅读这些 Android 文章
https://developer.android.com/training/wearables/watch-faces/index.html
https://developer.android.com/training/wearables/watch-faces/drawing.html
如果我可以让用户从图库中选择一张图片并将其转换为位图,那么将其设置为表盘似乎是合理的。当谈到 Android 和 apks 时,我绝对是一个初学者程序员。 来自更高级的 Android 开发人员的确认会很棒。
现在我感到困惑的是,是否会在用户的手机上选择图片并将其发送到 android 可穿戴应用程序,或者可穿戴应用程序是否能够访问用户手机的图库并选择它直接地。有谁知道可穿戴应用程序是否可以访问用户手机的图库?
假设我已经有选择的图像的参考,它会是这样的吗?如我错了请纠正我。 (摘自“初始化表盘元素”下的第二篇文章
@Override
public void onCreate(SurfaceHolder holder) {
super.onCreate(holder);
// configure the system UI (see next section)
...
// load the background image
Resources resources = AnalogWatchFaceService.this.getResources();
//at this point the user should have already picked the picture they want
//so set "backgroundDrawable" to the image the user picture
int idOfUserSelectPicture = GetIdOfUserSelectedPictureSomehow();
Drawable backgroundDrawable = resources.getDrawable(idOfUserSelectPicture, null);
//original implementation from article
//Drawable backgroundDrawable = resources.getDrawable(R.drawable.bg, null);
mBackgroundBitmap = ((BitmapDrawable) backgroundDrawable).getBitmap();
// create graphic styles
mHourPaint = new Paint();
mHourPaint.setARGB(255, 200, 200, 200);
mHourPaint.setStrokeWidth(5.0f);
mHourPaint.setAntiAlias(true);
mHourPaint.setStrokeCap(Paint.Cap.ROUND);
...
// allocate a Calendar to calculate local time using the UTC time and time zone
mCalendar = Calendar.getInstance();
}
感谢您的任何帮助。
【问题讨论】:
-
您的手表应用程序将通过数据层developer.android.com/training/wearables/data-layer/index.html 与您的安卓手机/平板电脑应用程序进行通信。我会先在手机/平板电脑应用程序上进行挑选,然后在手表一样小的屏幕上进行尝试。祝你好运。
-
谢谢,在手表上挑选图像是个好主意,因为可用的屏幕空间很少。因此,手机应用程序肯定会选择图片,然后将该数据发送到手表应用程序。
标签: android image gallery wear-os watch-face-api