繁体   English   中英

单击内部视图元素时,波纹效果不起作用(Android Appcelerator)

[英]Ripple effect not working when clicking inside view elements (Android Appcelerator)

https://gyazo.com/7ffd965136f18e44aa87c591e3b90ed9

正如您在我提供的链接中所看到的,当我单击标签或我在View中的ImageView时,涟漪效应不起作用。 我怎样才能解决这个问题?

我在6.1.2GA和6.2.2GA SDK中都遇到了这个问题

这是我的XML文件:

<CardView id="selectCard">
    <View layout='horizontal' backgroundColor="#fafafa" touchFeedback="true" touchFeedbackColor="#808080">
        <ImageView class="icons" id="locationIcon" image="/icons/address.png" top="8dp" bottom="8dp" left="16dp" />
        <Label class="titleLabel smallText" text="L('selectInMap')"  />
    </View>
</CardView>

我尝试删除我的CardView中的View,然后将touchFeedback和touchFeedbackColor属性设置为CardView,但后来我看不到任何涟漪效应

如果您不需要知道用户点击的确切元素,我建议将touchEnabled="false"用于阻止涟漪效应的UI元素。

您可以在文档中阅读更多相关信息: http//docs.appcelerator.com/platform/latest/#!/ api / Titanium.UI.Label-property-touchEnabled

在标签上设置touchEnabled:false并且imageview应该修复它

涟漪效应基本上用于让用户知道该区域是可触摸/可点击的,或者在触摸/点击时执行某些操作。

正如Rene Pot所回答的,这适用于Android 21+的任何Ti SDK。 即使在Ti.UI.TableView上也可以通过在所有UI元素上设置touchEnabled : false来使用相同的hack,以便在整行中使用Ripple。

这就是为什么Android在其尺寸上提供带有涟漪效应的按钮的原因相同,因为按钮严格按照触摸/点击执行操作。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM