代码拉取完成,页面将自动刷新
allprojects {
repositories {
...
mavenCentral()
}
}
implementation 'com.licheedev:multifunctionview:1.0.8'
属性
<declare-styleable name="MultiFunctionView">
<attr name="allTextSize" format="dimension" />
<attr name="widgetMargin" format="dimension" />
<attr name="leftLabelText" format="string" />
<attr name="leftLabelColor" format="color" />
<attr name="leftLabelTextSize" format="dimension" />
<attr name="leftLabelWidth" format="dimension" />
<attr name="leftMarqueeRepeatLimit" format="integer" />
<attr name="rightLabelText" format="string" />
<attr name="rightLabelTextSize" format="dimension" />
<attr name="rightLabelColor" format="color" />
<attr name="button1Text" format="string" />
<attr name="button2Text" format="string" />
<attr name="buttonTextColor" format="color" />
<attr name="buttonTextSize" format="dimension" />
<attr name="buttonBg" format="reference" />
<attr name="showButton">
<flag name="DEFAULT" value="-1" />
<flag name="NONE" value="0" />
<flag name="FIRST" value="1" />
<flag name="SECOND" value="2" />
<flag name="All" value="3" />
</attr>
<attr name="editHintColor" format="color" />
<attr name="editHintText" format="string" />
<attr name="editValueColor" format="color" />
<attr name="editValueText" format="string" />
<attr name="editSelectionTextSize" format="dimension" />
<attr name="editSelectionWidth" format="dimension" />
<attr name="editSelectionHeight" format="dimension" />
<attr name="selectionArrowImage" format="reference" />
<attr name="editTextMaxLength" format="integer" />
<attr name="editInputMode">
<flag name="NUMBER" value="1" />
<flag name="CHARACTER" value="2" />
<flag name="NEGATIVE" value="3" />
</attr>
<attr name="isEditText" format="boolean" />
<attr name="ifSelectionBg" format="reference" />
<attr name="ifEditBg" format="reference" />
<attr name="showSelectionArrow" format="boolean" />
<attr name="showEditSelection" format="boolean" />
<attr name="spinnerItemLayout" format="reference" />
<attr name="spinnerItemTextId" format="reference" />
</declare-styleable>
BindingAdapter
@BindingAdapter("app:mfvEditValue")
fun mfvEditValue(view: MultiFunctionView, value: Any?) {
if (value == null) {
view.editText.setText("", false)
} else {
view.editText.setText(value.toString(), false)
}
}
@BindingAdapter("app:mfvSelectionData")
fun mfvSelectionData(view: MultiFunctionView, map: Map<String, *>?) {
if (map == null) {
return
}
view.setData(map)
}
@BindingAdapter("app:mfvSelectionData")
fun mfvSelectionData(view: MultiFunctionView, list: List<*>?) {
if (list == null) {
return
}
view.setData(list.map { it.toString() })
}
@BindingAdapter("app:mfvButton1Action")
fun mfvButton1Action(view: MultiFunctionView, action: (() -> Unit)?) {
view.button1.setOnClickListener {
action?.invoke()
}
}
@BindingAdapter("app:mfvButton2Action")
fun mfvButton2Action(view: MultiFunctionView, action: (() -> Unit)?) {
view.button2.setOnClickListener {
action?.invoke()
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。