- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我编写了一个在圆形和方形 watch 上运行的应用程序,具有两个布局和一个 watchViewStub。由于 moto 360 在欧洲销售,我有很多报告说 Moto 360 没有加载圆形布局。使用模拟器,我无法重现此行为,即使我按此处说明更改语言环境:https://developer.android.com/guide/topics/resources/localization.html#testing所以我想这是我的代码......
我是这样实现的:
<android.support.wearable.view.WatchViewStub
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/watch_view_stub"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:rectLayout="@layout/rect_activity_camera"
app:roundLayout="@layout/round_activity_camera">
然后在 fragment 中我给 WatchViewStub 充气
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
final WatchViewStub stub = (WatchViewStub) getView().findViewById(R.id.watch_view_stub);
stub.setOnLayoutInflatedListener(new WatchViewStub.OnLayoutInflatedListener() {
@Override
public void onLayoutInflated(WatchViewStub stub) {
...
}
}
该 fragment 用于 FragmentViewPager/FragmentGridPagerAdapter。在我获得 Moto 360 之前,有什么关于如何调试它的想法吗?
编辑
Wear Sdk 中的 WatchViewStub 示例有两种不同的行为,具体取决于语言设置,所以我填写了这个问题:https://code.google.com/p/android/issues/detail?id=77642
重要
此问题在不同的帖子中进行了讨论。为了避免重复更新的信息,只会更新谷歌代码上的问题,一旦问题得到解决,我将完成这篇文章: https://code.google.com/p/android/issues/detail?id=77642
最佳答案
由于没有正确使用 WatchViewStub 而导致的 inflating layout 有很多问题。我没有看到上面的足够代码来确切地知道,但是一个常见的问题是当你为 watch insets 注册一个监听器时:
final WatchViewStub stub = (WatchViewStub) findViewById(R.id.watch_view_stub);
stub.setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() {
@Override
public WindowInsets onApplyWindowInsets(View view, WindowInsets windowInsets) {
// Need to also call the original insets since we have overridden the original
// https://developer.android.com/reference/android/view/View.OnApplyWindowInsetsListener.html
stub.onApplyWindowInsets(windowInsets);
return windowInsets;
}
});
我见过人们忘记返回 windowInsets 或忘记调用 stub.onApplyWindowInsets() 的情况。这具有提供方形布局而不是圆形布局的效果。
其他问题是由于忘记将与 square.xml 相同的 XML 元素放入 round.xml 引起的。
您在 adb logcat 中收到的错误消息是什么?
关于android - 某些 Moto 360 不加载圆形布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26369375/
我希望有人能帮我解决这个问题。 前段时间我开发了一个应用程序,目的是在智能手机中同时记录前置麦克风和后置麦克风捕获的声音。基本上,我会像这样制作下一个对象: AudioRecord audioReco
我正在编写一个 lambda 函数,它获取 CW 日志组列表并对每个日志组运行“导出到 s3”任务。 我正在使用 pytest 编写自动化测试我正在使用 moto.mock_logs (除其他外),但
我有一个名为 check_stuff 的函数,它实例化一个对象并调用函数 describe_continuous_backups,但是,moto 尚不支持此功能,因此我需要自己手动模拟它。我有以下内容
总而言之,我一遍又一遍地在谷歌上搜索以找到解决方案,虽然我发现了一个关于相机释放等的错误,但我似乎无法让凸轮代码正常工作。每次我执行 takePicture 时,系统都会挂起,有时它会调用 Pictu
我不知道其他人是否也遇到过这种情况。连接到 Moto 360 (Android Wear) 上的 Sensor.TYPE_MAGNETIC_FIELD 传感器时,我没有收到任何更新。 以下代码都有效:
我目前正在尝试使用 Moto 和 @mock_dynamodb2 为我的 python 代码编写单元测试。到目前为止,我一直在测试我的“成功操作”测试用例。但是我很难让它为我的“失败案例”工作。 在我
通过 goCoder SDK 使用 Wowza Streaming Cloud 开始流式传输时,Moto g 和三星 s6 中的摄像头当时无法打开,但当我切换摄像头时,两个摄像头(后置和前置)都可以正
我需要访问 Moto 设备 (5.0.1) 上的数据漫游状态 if (Settings.Secure.getInt(context.getContentResolver(),Settings.Secu
上周买了新的 Moto G XT1033,手机工作正常,但作为开发人员,我发现在 Debug模式下很难,即使在开发人员选项中启用 USB 调试选项之后... 必要时出现错误 USB 驱动程序 未找到
我有一台 Windows 7 x64 Ultimate 计算机,我想在 Debug模式下连接我的 Moto X 2nd Gen (XT1097),以便我可以开发一些应用程序。 p> 问题是,Windo
我正在尝试测试一些使用 boto 的 python 代码。我不想尝试针对 AWS 进行集成测试,所以我尝试用 moto 模拟它,但它的行为并不像我预期的那样。 测试代码如下: import io im
我最近在 android wearable(MOTO 360) 上开发应用。 我的问题是,是否可以将传感器数据作为文件保存在我的 watch 中?或者我必须将这些数据发送回我的掌上电脑进行保存? 我尝
我编写了一个在圆形和方形 watch 上运行的应用程序,具有两个布局和一个 watchViewStub。由于 moto 360 在欧洲销售,我有很多报告说 Moto 360 没有加载圆形布局。使用模拟
我正在尝试通过蓝牙在我的 Moto 360 上进行调试。我正在关注这些 instructions但是当我输入 adb forward tcp:4444 localabstract:/adb-hub;
我正在测试一些 dynamodb 访问代码。在过去,对分页的不正确处理导致了错误(开发人员倾向于使用少量数据进行手动测试,因此很容易对分页的工作原理做出错误的假设,只有在处理实际数据量时才会出现这种假
在我的代码中的某处,lambda 被调用以返回 true/false 响应。我试图在我的单元测试中模拟这个 lambda 但没有成功。 这是我的代码: def _test_update_allowed
我正在尝试用 moto 模拟 AWS SQS,下面是我的代码 from myClass import get_msg_from_sqs from moto import mock_sqs #from
在我的单元测试中: def test_my_function_that_publishes_to_sns(): conn = boto3.client("sns", region_name="
我正在尝试模拟计算环境的创建,这需要一些其他资源,即 IAM 实例配置文件和服务角色。但是,当我创建这些 IAM 资源然后尝试在计算环境创建中使用它们时,事情失败了: Role arn:aws:iam
我想对从 aws 导入的文件进行测试。 我使用 moto 模拟 s3,以免弄乱实际数据。但是,现在 aws 似乎是空的,因此我决定在模拟的 s3 上上传一些测试文件。我该怎么做? 这是我的设置, 比赛
我是一名优秀的程序员,十分优秀!