简体   繁体   English

在手机上测试Android Wear应用?

[英]Test Android Wear apps on phone?

Interestingly enough, I noticed that when developing, I can choose to run a Wear app on the phone instead of a Wear device. 有趣的是,我注意到在开发时,我可以选择在手机上运行Wear应用程序,而不是Wear设备。 It looks the same--just huge, of course. 看起来一样-当然很大。

Based on https://plus.google.com/+AndroidDevelopers/posts/QhWQArNDfS3 , I gather I could use ADB to make the phone screen small enough to do a fair imitation of a rectangular smartwatch... 基于https://plus.google.com/+AndroidDevelopers/posts/QhWQArNDfS3 ,我收集到了可以使用ADB将电话屏幕缩小到足以公平模仿矩形智能手表的信息...

But what about testing for round Android Wear devices? 但是,如何对圆形Android Wear设备进行测试呢? Is there something I can do to the phone (or a rectangular Android Wear device, for that matter) to make it show as a circle (and even better, identify as a round device to Android Wear) in order to test the round interfaces? 为了测试圆形界面,我是否可以对手机(或矩形Android Wear设备)做为使其显示为圆形(甚至更好,标识为Android Wear圆形设备)的事情?

Yes, there's always cutting a round hole out of a page and holding that over the device, but that's obviously far from ideal. 是的,总是在页面上切出一个圆孔并将其固定在设备上,但这显然不理想。

You can test your app on a round emulator. 您可以在圆形模拟器上测试您的应用程序。 Here are instructions how to do this: https://developer.android.com/training/wearables/apps/creating.html 以下是如何执行此操作的说明: https : //developer.android.com/training/wearables/apps/creating.html

EDIT: About round and forcing round on a square device: you can try to pretend that the device is round, but it's a little hacky and ugly. 编辑:关于在方形设备上进行回合和强制回合:您可以尝试假装该设备是回合的,但是它有点笨拙和丑陋。

In your Activity you need to implement inset listener and then use reflection to change WindowInsets.mRound field. 在您的Activity您需要实现插入侦听器,然后使用反射更改WindowInsets.mRound字段。 Then dispatch the insets further down the hierarchy. 然后将插图进一步分配到层次结构中。 This will trick your views to think that the device is round. 这将欺骗您的观点,使您认为设备是圆形的。

Check this article about handling square and round: http://gruszczy.blogspot.com/2015/03/handling-round-screens-using.html It describes how insets with the information about device display type are delivered. 请查看有关处理方形和圆形的这篇文章: http : //gruszczy.blogspot.com/2015/03/handling-round-screens-using.html它描述了如何传递有关设备显示类型信息的插图。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM