【问题标题】:How to set a clear button in textfield for android in titanium?如何在钛中为android的文本字段设置清除按钮?
【发布时间】:2019-02-01 09:30:28
【问题描述】:

我正在尝试使用 clearbuttonmode 在文本字段中设置一个清除按钮,它在 Ios 平台上运行良好,并且没有显示在 android 中。

【问题讨论】:

    标签: titanium appcelerator appcelerator-titanium appcelerator-mobile


    【解决方案1】:

    由于clearButtonMode(检查您的拼写)仅适用于 iOS,正如您在文档中看到的那样,我将采用多平台方式并创建一个自己的按钮并将其添加到 TextField 旁边。这些按钮只是将 TextField 值设置为 "" 以清除该字段。您甚至可以将所有内容放在带有白色背景和边框的 <View> 中,这样看起来清晰的按钮就在 TextField 内

    伪代码:

    <View height="Ti.UI.SIZE" width="300">
      <TextField left="0" right="40"/>
      <Button width="40" right="0"/>
    </View>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-07-29
      • 2022-11-09
      • 2019-06-10
      • 2013-05-14
      相关资源
      最近更新 更多