Lorenzo Suarez
Lorenzo Suarez

Reputation: 11

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

Upvotes: 1

Views: 45

Answers (1)

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

Upvotes: 0

Related Questions