6.3 Button Control
button control用于在kodi中创建按钮,你可以选择位置、大小和按钮的外观,同时可以选择创建按钮的时候执行那种操作。
6.3.1 Example
<control type="button" id="1">
<description>My first button control</description>
<left>80</left>
<top>60</top>
<width>250</width>
<height>200</height>
<visible>true</visible>
<colordiffuse>FFFFFFFF</colordiffuse>
<texturefocus colordiffuse="FFFFAAFF">myfocustexture.png</texturefocus>
<texturenofocus colordiffuse="FFFFAAFF">mynormaltexture.png</texturenofocus>
<label>29</label>
<wrapmultiline>true</wrapmultiline>
<font>font12</font>
<textcolor>FFFFFFFF</textcolor>
<focusedcolor>FFFFFFFF</focusedcolor>
<disabledcolor>80FFFFFF</disabledcolor>
<invalidcolor>FFFFFFFF</invalidcolor>
<align></align>
<aligny></aligny>
<textoffsetx></textoffsetx>
<textoffsety></textoffsety>
<pulseonselect></pulseonselect>
<onclick>XBMC.ActivateWindow(MyVideos)</onclick>
<onfocus>-</onfocus>
<onunfocus>-</onunfocus>
<onup>2</onup>
<ondown>3</ondown>
<onleft>1</onleft>
<onright>1</onright>
</control>
6.3.2 Available tags
除了默认控件标签下面的标签可用。请注意,每个标签仅是小写。这一点很重要,因为XML标签是区分大小写的。
tag | Description |
---|---|
texturefocus | 当按钮获取焦点时,指定需要显示的图片。 See here for additional information about textures. |
texturenofocus | 当按钮失去焦点时,指定需要显示的图片。 |
label | 按钮上要用到的标签,可以在string.xml中定义,或者只是一个文字标签。 |
font | 按钮标签需要的字体。 定义在 fonts.xml. |
textcolor | Color used for displaying the button label. In AARRGGBB hex format, or a name from the colour theme. |
focusedcolor | Color used for the button label when the button has in focus. In AARRGGBB hex format or a name from the colour theme. |
disabledcolor | Color used for the button label if the button is disabled. In AARRGGBB hex format or a name from the colour theme. |
invalidcolor | Color used for the button if the user entered some invalid value. In AARRGGBB hex format or a name from the colour theme. |
shadowcolor | Specifies the color of the drop shadow on the text, in AARRGGBB format, or a name from the colour theme. |
angle | The angle the text should be rendered at, in degrees. A value of 0 is horizontal. |
align | Label horizontal alignment on the button. Defaults to left, can also be center or right. |
aligny | Label vertical alignment on the button. Defaults to top, can also be center. |
textoffsetx | Amount to offset the label from the left (or right) edge of the button when using left or right alignment. |
textoffsety | Amount to offset the label from the top edge of the button when using top alignment. |
textwidth | Will truncate any text that's too long. |
onclick | 指定在按下按钮时执行的操作。应该是一个内置的功能。在这里看到更多的信息。您可能有多个<onclick>标签,他们会按顺序执行 See here for more information. |
onfocus | Specifies the action to perform when the button is focused. Should be a built in function. The action is performed after any focus animations have completed. See here for more information. |
onunfocus | Specifies the action to perform when the button loses focus. Should be a built in function. |
wrapmultiline | Will wrap the label across multiple lines if the label exceeds the control width. |