显示一个需要用户互动的对话屏幕。一旦窗口关闭,它就会发送发生的对话事件。
identifier:ui_page_dialog
属性
类型。定义了通知的可视化。
可能的值。信息、中级进展、进展、问题、通知、警告、错误、死亡
标题。对话框的一个简短名称。
可能的值。可以是一个对安卓资源的引用,也可以是一个字符串。
构成要素
消息。包含将在对话框中显示的信息的列表。可以引用一个上下文变量或一个消息列表。当引用一个上下文变量时,属性context_variable被设置为布尔值true。
按钮。这包含一个用户可以点击的三个按钮的列表。
钮扣
有三个按钮,用户可以点击。
- 上一页_页面_btn
- 下一个_页面_btn
- close_btn
文字。写在按钮上的内容。
Speech_command:触发此按钮的语音命令。
重点突出。设定一个按钮为预选。
命令。一旦按钮被按下就会触发的事件命令。这只适用于close_btn。
输出
一旦按钮被点击(或其语音命令被识别),就会触发包含按钮内指定命令的事件。
实例
最小的
<ui_page_dialog id="show-server-errors-dialog" type="ERROR" title="Procedure failed">
<messages>
<message>First Error...</message>
<message>Second Error...</message>
<message>Third Error...</message>
</messages>
<buttons>
<previous_page_btn>
<param name="text">←</param>
<param name="speech_command">PREVIOUS</param>
</previous_page_btn>
<next_page_btn>
<param name="text">→</param>
<param name="speech_command">NEXT</param>
<param name="focused">true</param>
</next_page_btn>
<close_btn>
<param name="text">ANDRRES_cancel</param>
<param name="command">EXIT_PAGER</param>
<param name="speech_command">CANCEL</param>
</close_btn>
</buttons>
</ui_page_dialog>
所有选项
<ui_page_dialog id="confirm_pick" type="INFO" title="Here we go again">
<messages>
<message>what</message>
<message>to</message>
<message>do</message>
</messages>
<buttons>
<previous_page_btn>
<text><![CDATA[<]]></text>
<speech_command>PREVIOUS</speech_command>
<focused>false</focused>
</previous_page_btn>
<next_page_btn>
<text><![CDATA[>]]></text>
<speech_command>NEXT</speech_command>
<focused>true</focused>
</next_page_btn>
<close_btn>
<text>Return</text>
<command>BW</command>
<speech_command>RETURN</speech_command>
<focused>false</focused>
</close_btn>
</buttons>
</ui_page_dialog>
使用 context_variable = true
<ui_page_dialog id="confirm_what_to_do" type="INFO" title="Here we go again">
<messages context_variable="true">#{what_to_do}</messages>
<buttons>
<previous_page_btn>
<text><![CDATA[<]]></text>
<speech_command>PREVIOUS</speech_command>
<focused>false</focused>
</previous_page_btn>
<next_page_btn>
<text><![CDATA[>]]></text>
<speech_command>NEXT</speech_command>
<focused>false</focused>
</next_page_btn>
<close_btn>
<text>ANDRRES_cancel</text>
<command>BW</command>
<speech_command>RETURN</speech_command>
<focused>false</focused>
</close_btn>
</buttons>
</ui_page_dialog>
处理结果
<rule id="confirm_what_to_do_back">
<expression> <![CDATA[#{event:command} == 'BW' || #{event:command} == 'RETURN']]> </expression>
<actions>
<action ref="backwards"></action>
</actions>
</rule>