java - 如何在 BootstrapDropDown 的项目中添加 onclick 事件
问题描述
我需要知道您何时单击其中一个元素
可以使用 'android:onClick' 从 xml 完成吗?这是我的代码:
<com.beardedhen.androidbootstrap.BootstrapDropDown
app:bootstrapExpandDirection="up"
android:text="Cards"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#ea2c2c"
app:bootstrapBrand="primary"
app:bootstrapSize="lg"
app:dropdownResource="@array/dropdown_cards"
app:showOutline="false"/>
@array/dropdown_cards :
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<string-array name="dropdown_cards">
<item android:onClick="btnCardOption">@string/analyze</item>
<item>@string/history</item>
</string-array>
解决方案
也许您可以通过创建下拉实例然后添加 onClickListener 从您的活动/片段代码中添加它。
推荐阅读
- python - 如何使用逻辑运算符在正则表达式中的模式中添加两个子模式?
- momentjs - 从国家或地区名称获取代码以设置 locale() moment.js
- java - Maven在不同的机器上添加不同的依赖?
- c# - bot框架v3中的消息卡渲染问题
- javascript - 自定义高度的动态元素如何在没有空格的情况下对齐?
- drupal-7 - Drupal 7视图显示术语描述
- microsoft-graph-api - 用于更改其他用户密码的图形 API
- python - 根据分组列和行级比较过滤 Python-pandas 中的非重复记录
- matplotlib - 适合多行字幕(没有足够的垂直空间)
- php - laravel 有可能达到 1000 TPS 吗?