小编Lan*_*don的帖子

在Android Studio中编译简单的可穿戴应用程序 - 未找到WatchActivity

我按照此链接中的说明在Android Studio中创建了一个简单的移动/可穿戴应用程序.但是,它不会识别任何特定于可穿戴SDK的类,会出现错误"无法解析符号______ ".这个链接的截图就是我所看到的.

以下是我的build.gradle文件:

apply plugin: 'com.android.application'
android {
    compileSdkVersion 20
    buildToolsVersion '20.0.0'
    defaultConfig {
         applicationId 'com.example.lsykora.androidwearwidget'
         minSdkVersion 'L'
         targetSdkVersion 'L'
         versionCode 1
         versionName '1.0'
}
buildTypes {
    release {
        runProguard false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-    rules.pro'
    }
}
productFlavors {}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
// You must install or update the Support Repository through the SDK manager to use      this dependency.
// You must install or update the Support Repository through …
Run Code Online (Sandbox Code Playgroud)

android android-studio wear-os

6
推荐指数
1
解决办法
1420
查看次数

Android Wear - 通知 - setContentAction()不起作用

我正在创建一个从可穿戴设备发出的通知,只在可穿戴设备上发出,而不是在手机上.我希望它有两个动作按钮(还没有功能)和第三个动作,当点击通知本身时.我正在尝试使用setContentAction()使最后一个操作成为单击通知时的操作,但它仍然显示为单独的操作按钮(根据此处的文档,它不应显示单独的按钮).然而,这个不需要的按钮激发了所需的意图.通知本身不响应点击.以下是创建通知的代码:

    Intent pictureIntent = new Intent(this, PictureActivity.class);
    PendingIntent pendingIntent = PendingIntent.getActivity(this, 254, pictureIntent, PendingIntent.FLAG_ONE_SHOT);

    NotificationCompat.Builder notificationBuilder =
            new NotificationCompat.Builder(this)
                    .setSmallIcon(R.drawable.medicinepillmd)
                    .setContentTitle(dose[0])
                    .setContentText(dose[3])
                    .extend(new NotificationCompat.WearableExtender()
                            .setContentIcon(R.drawable.thumbnail)
                            .setBackground(BitmapFactory.decodeResource(getResources(), R.drawable.orangegirl))
                            .addAction(new NotificationCompat.Action.Builder(R.drawable.medicinepillmd, "Taken", null).build())
                            .addAction(new NotificationCompat.Action.Builder(R.drawable.thumbnail, "Skipped", null).build())
                            .addAction(new NotificationCompat.Action.Builder(0, null, pendingIntent).build())
                            .setContentAction(2));
Run Code Online (Sandbox Code Playgroud)

任何人都知道为什么这可能不符合预期的行为?任何输入赞赏.谢谢

android android-notifications wear-os

5
推荐指数
1
解决办法
1323
查看次数

Xcode - 如果单击文件,则查找现有选项卡而不是始终打开新选项卡

在 Xcode 10.0 中,假设我在两个选项卡中打开了两个文件,fileA.txt 和 fileB.txt。我有一个带有 fileA 活动和重点的选项卡。如果我尝试从 navigator打开 fileB.txt ,我希望它切换到我已经打开 fileB 的现有选项卡,而不是在焦点选项卡中打开 fileB (并淘汰 fileA)。我相信这是 Eclipse 和 Visual Studio 的默认行为。

额外问题:如何在导航器中单击文件而不执行任何操作?目前它打开文件(我只想要双击时的行为)。

xcode

5
推荐指数
0
解决办法
55
查看次数