Skip to content

OnClick behaviour not working #8

Description

@Thomas-Vos

The new click behaviour will come in very handy for me. Unfortunately, I cannot get it working for my knob configuration. Here is the Knob style I'm using:

<style name="KnobStyle">
    <item name="kNumberOfStates">21</item>
    <item name="kSwipe">circular</item>
    <item name="kMinAngle">-120</item>
    <item name="kMaxAngle">120</item>
    <item name="kKnobColor">?attr/colorAccent</item>
    <item name="kKnobRelativeRadius">0.75</item>
    <item name="kKnobCenterRelativeRadius">0.75</item>
    <item name="kIndicatorRelativeLength">0.35</item>
    <item name="kStateMarkersAccentWidth">2dp</item>
    <item name="kStateMarkersWidth">2dp</item>
    <item name="kFreeRotation">false</item>
    <item name="kBorderWidth">0dp</item>
    <item name="kStateMarkersAccentPeriodicity">5</item>
    <item name="kStateMarkersAccentColor">?android:attr/textColorPrimary</item>
    <item name="kSelectedStateMarkerContinuous">true</item>
    <item name="kSelectedStateMarkerColor">?attr/colorAccent</item>
    <item name="kStateMarkersColor">?android:attr/textColorSecondary</item>
    <item name="kClickBehaviour">user</item>
</style>

Here is the Java code:

knob.setUserBehaviour(new Runnable() {
    @Override
    public void run() {
        Toast.makeText(getContext(), "Knob clicked!", Toast.LENGTH_SHORT).show();
    }
});

The Toast message does not show when I click the Knob. If I change kSwipe to horizontal it does work, but I really want to keep it on circular. Any suggestions?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions