Android Wear RemoteInput setChoices自定义

时间:2015-04-26 18:51:15

标签: android wear-os

通过以下链接中的“添加预定义文本响应”部分,我可以添加“是”,“否”等选项。

https://developer.android.com/training/wearables/notifications/voice-input.html

我想根据每个选项自定义Icon。怎么做?

现有的:

Remote Input Choice action

我想要的是什么:

在下图中,我想自定义每个图标。

enter image description here

使用的代码。

RemoteInput remoteInput = new RemoteInput.Builder("com.example.android.support.wearable.notifications.REPLY")
                .setLabel("Choose Car")
                .setAllowFreeFormInput(true)
                .setChoices(new String[] { "Choice 1", "Choice 2", "Choice 3" })
                .build();

        NotificationCompat.Action chooseCarAction = new NotificationCompat.Action.Builder(
                R.drawable.uber_badge,
                "Choose Car",
                uberPendingIntent)
                .addRemoteInput(remoteInput)
                .build();

        NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(context)
                .setSmallIcon(R.drawable.ic_launcher)
                .setVibrate(new long[]{50, 50, 50})
                .setContentTitle("Wake Up")
                .setContentText("Train reached Bangalore Cantonment Station.")
                        //.setStyle(bigStyle.bigText(content))

                .setLargeIcon(BitmapFactory.decodeResource(context.getResources(), R.drawable.ic_launcher))
        mNotificationManager.notify(notifyId, notificationBuilder.build());

0 个答案:

没有答案