我在bixby中用缩略图卡在用户屏幕上显示了多个选择。还添加了用于点击的广告位。我要实现的目标是,如果用户单击缩略图,我应该获取特定卡的ID并对其进行处理以获取更多信息。这就是布局
layout-macro-def (artist-thumbnail-card) {
params {
param (artistchoice) {
type (ArtistChoiceResult)
min (Required) max (One)
}
}
content {
thumbnail-card {
image-position (Start)
image-url ("#{value(artistchoice.multiple_image)}")
title-area {
halign (Start)
slot1 {
text {
value ("#{value(artistchoice.multiple_name)}")
style (Title_S)
}
}
slot2 {
single-line {
text {
value ("From #{value(artistchoice.multiple_cat)}")
style (Detail_L_Soft)
}
}
}
}
on-click {
intent {
goal: ArtistSearch
}
}
}
}
}
这是结果视图
result-view {
match: ArtistChoiceResult (artistchoice) {
from-output: ArtistChoice
}
message {
template ("Please select one of the following")
}
render {
if (size(artistchoice) > 1) {
list-of (artistchoice) {
has-details (true)
where-each (item) {
layout-macro (artist-thumbnail-card) {
param (artistchoice) {
expression (item)
}
}
}
}
} else-if (size(artistchoice) == 1) {
layout-match (artistchoice) {
mode (Details)
}
}
}
}
我无法将ID信息发送到artistSearch Intent。我将如何实现这一目标。而且我在其他变量中有ID,那么如何传递该值?
答案 0 :(得分:0)
根据您提供的代码,我们必须假设两件事:
1)这是为/* simplest version of calculator */
%{
# include <stdio.h>
FILE * fin;
int yylex (void);
void yyerror(char *s);
%}
/* declare tokens */
%token NUMBER
%token ADD SUB MUL DIV ABS
%token OP CP
%%
calclist: /* nothing */
| calclist exp { printf("= %d\n", $2); }
;
exp: factor
| exp ADD exp { $$ = $1 + $3; }
| exp SUB factor { $$ = $1 - $3; }
| exp ABS factor { $$ = $1 | $3; }
;
factor: term
| factor MUL term { $$ = $1 * $3; }
| factor DIV term { $$ = $1 / $3; }
;
term: NUMBER
| ABS term { $$ = $2 >= 0? $2 : - $2; }
| OP exp CP { $$ = $2; }
;
%%
/* The lexical analyzer returns a double floating point
number on the stack and the token NUM, or the numeric code
of the character read if not a number. It skips all blanks
and tabs, and returns 0 for end-of-input. */
#include <ctype.h>
#include <string.h>
int yylex (void)
{
char c;
/* Skip white space. */
while ((c = getc(fin)) == ' ' || c == '\t'){
continue;
}
// printf("%s", &c);
/* Process numbers. */
if (c == '.' || isdigit (c))
{
ungetc(c, fin);
fscanf (fin, "%d", &yylval);
return NUMBER;
}
/* Process addition. */
if (c == '+')
{
return ADD;
}
/* Process sub. */
if (c == '-')
{
return SUB;
}
/* Process mult. */
if (c == '*')
{
return MUL;
}
/* Process division. */
if (c == '/')
{
return DIV;
}
/* Process absolute. */
if (c == '|')
{
return ABS;
}
/* Process left paren. */
if (c == '(')
{
return OP;
}
/* Process right paren. */
if (c == ')')
{
return CP;
}
/* Return a single char. */
yyerror(&c);
return c;
}
int main(int argc, char** argv)
{
// evaluate each command line arg as an arithmetic expression
int n=1;
while (n < argc) {
if(argv[n]){
// yy_scan_string(argv[n]);
// fin = stdin;
fin = fmemopen(argv[n], strlen (argv[n]), "r");
printf("%s ",argv[n]);
fflush(stdout);
yyparse();
}
n++;
}
return 0;
}
void yyerror(char *s)
{
fprintf(stderr, "error: %s\n", s);
}
结构触发的结果视图
2)artistchoice
是一个包含所有选项的数组。
基于上述假设,您需要构建一个布局,其中multiple_name
的每个元素(multiple_name
,multiple_name[1]
,multiple_name[2]
等)。 / p>
由于不能用可变单击事件定义一个单击事件,因此您需要为每个多选选项创建一个单独的卡,因此每张卡只有一个单击事件。这将使单击时看起来如下所示:
multiple_name[3]
如果您需要任何其他信息,请联系support team,我们将在此讨论您面临的任何特定问题,这些问题可能对于您的用例来说是唯一的。