Kodi ——6 Controls (7)Toggle button control

6.7 切换按钮控件

     切换按钮控件用于创建具有2个状态的按钮。您可以选择的位置,大小,和按钮的外观。当用户点击切换按钮,状态会发生变化,触发额外的纹理(alttexturefocus和alttexturenofocus)。用于在需要两种状态的控件(例如推入和推出)。

6.7.1 Example

<control type="togglebutton" id="25">
      <description>My first togglebutton control</description>
      <left>80</left>
      <top>60</top>
      <width>250</width>
      <height>200</height>
      <visible>true</visible>
      <colordiffuse>FFFFFFFF</colordiffuse>
      <texturefocus>myfocustexture.png</texturefocus>
      <texturenofocus>mynormaltexture.png</texturenofocus>
      <alttexturefocus>myselectedTexture.png</alttexturefocus>
      <alttexturenofocus>myselectedTexture_nf.png</alttexturenofocus>
      <usealttexture>!Player.IsPaused</usealttexture>
      <label>29</label>
      <altlabel>29</altlabel>
      <font>font12</font>
      <textcolor>FFFFFFFF</textcolor>
      <disabledcolor>80FFFFFF</disabledcolor>
      <align>left</align>
      <aligny>center</aligny>
      <textoffsetx>4</textoffsetx>
      <textoffsety>5</textoffsety>
      <pulseonselect>false</pulseonselect>
      <onclick>Player.Pause</onclick>
      <onfocus>-</onfocus>
      <onunfocus>-</onunfocus>
      <onup>2</onup>
      <ondown>3</ondown>
      <onleft>1</onleft>
      <onright>1</onright>
      <wrapmultiline>false</wrapmultiline>
</control>

6.7.2 Available tags

In addition to the Default Control Tags the following tags are available. Note that each tag is lower case only. This is important, as xml tags are case-sensitive.

TagDescription
texturefocus

Specifies the image file which should be displayed when the button has focus. See here for additional information about texture tags.

texturenofocusSpecifies the image file which should be displayed when the button does not have focus.
alttexturefocusSpecifies the image file which should be displayed when the toggle button is in it's selected state. This texture replaces the <texturefocus> texture when the toggle button is selected.
alttexturenofocusSpecifies the image file which should be displayed when the button is in it's selected state but unfocused.
usealttexture

Specifies the conditions under which the Alternative Textures should be shown. Some toggle button controls are handled by Kodi internally, but any extra ones that the skinner has can be controlled using this tag. See here for more information.

labelThe label used on the button. It can be a link into strings.xml, or an actual text label.
altlabelThe alternate label used on the button. It can be a link into strings.xml, or an actual text label.
altclickThe alternate action to perform when the button is pressed. Should be a built in function. See here for more information. You may have more than one <altclick> tag, and they'll be executed in sequence.
fontFont used for the button label. From fonts.xml.
textcolorColor used for displaying the button label. In AARRGGBB hex format, or a name from the colour theme.
disabledcolorColor used for the button label if the button is disabled. In AARRGGBB hex format, or a name from the colour theme.
shadowcolorSpecifies the color of the drop shadow on the text. In AARRGGBB hex format, or a name from the colour theme.
alignLabel horizontal alignment on the button. Defaults to left, can also be center or right.
alignyLabel vertical alignment on the button. Defaults to top, can also be center.
textoffsetxAmount to offset the label from the left (or right) edge of the button when using left or right alignment.
textoffsetyAmount to offset the label from the top edge of the button when using top alignment.
textwidthWill truncate any text that's too long.
onclick

Specifies the action to perform when the button is pressed. Should be a built in function. See here for more information. You may have more than one <onclick> tag, and they'll be executed in sequence.

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

Allows wrapping on the label across multiple lines. Defaults to false.


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值