List Item Switch Widget
siddutgikar edited this page Jul 31, 2020
·
1 revision
The widget is an extension of the List Item Title Widget. The primary purpose of this widget is to represent binary states and provide the user an option to toggle between them.
abstract class ListItemSwitchWidget<T> @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ListItemTitleWidget<T>(context, attrs, defStyleAttr)
The widget provides API to toggle the presentation of the switch.
-
protected fun setChecked(isSwitchChecked: Boolean)
This function can be used to change the state of the widget.
Example of the widget is Novice Mode List Item Widget.
The UI elements can be customized to match the style of the user's application. The customizations can be done using attributes in XML or programmatically using the APIs.
List of the customizable XML attributes
-
uxsdk_list_item_switch_thumb_icon
- The icon for the switch thumb. -
uxsdk_list_item_switch_track_icon
- The icon for the switch track. -
uxsdk_list_item_switch_background
- The background for the switch.
List of the customization APIs
-
var switchThumbIcon: Drawable?
- The icon for the switch thumb. -
var switchTrackIcon: Drawable?
- The icon for the switch track. -
var switchBackground: Drawable?
- The background for the switch.
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false" android:drawable="@drawable/track_gray_border" />
<item android:state_enabled="true" android:state_checked="true" android:drawable="@drawable/track_solid_green" />
<item android:state_enabled="true" android:drawable="@drawable/track_white_border" />
</selector>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false" android:drawable="@drawable/thumb_icon_disabled" />
<item android:drawable="@drawable/thumb_icon_enabled" />
</selector>
DJI UX SDK Version 5 Beta 5
UX SDK 5.0 Overview
Core Module
Camera Core Module
Visual Cameras Module
- Camera Config