How to create a dual action (normal + switch) preference in Android?

Viewed 38

Is there any way to achieve this dual-action preference item? Preferably via a third party library but via a simple implementation if necessary.

The 'wireless debugging' preference in Android's developer mode is a dual preference. It's the only one I've seen and I have no idea what this preference is called or if any Jetpack or other libraries expose such a thing.

Tapping the left part (1) opens a new screen, while tapping the right toggle (2) simply toggles the preference without changing screens. There's also a little divider between them to indicate that they have separate actions.

enter image description here

1 Answers

Well There is an element in AndroidStudio Call Switch which is similar to this use that in XML file

<Switch
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.1"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />
Related