How to add onclick event in the items of BootstrapDropDown

问题: I need to know when you click on one of the elements It can be done from the xml using 'android:onClick' ? This is my code: <com.beardedhen.androidbootstrap.Bootstra...

问题:

I need to know when you click on one of the elements

It can be done from the xml using 'android:onClick' ? This is my code:

<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>


回答1:

Maybe you can add it from your activity/fragment code by creating an instance of the drop down and then adding the onClickListener.

  • 发表于 2019-07-07 23:22
  • 阅读 ( 203 )
  • 分类:sof

条评论

请先 登录 后评论
不写代码的码农
小编

篇文章

作家榜 »

  1. 小编 文章
返回顶部
部分文章转自于网络,若有侵权请联系我们删除