@@ -7,6 +7,7 @@ import android.content.Context
77import android.graphics.Color
88import androidx.fragment.app.Fragment
99import android.util.AttributeSet
10+ import android.util.Log
1011import android.view.*
1112import android.widget.FrameLayout
1213import android.widget.ImageView
@@ -23,7 +24,7 @@ class StateLayout @JvmOverloads constructor(context: Context, attributeSet: Attr
2324 var animDuration = 250L
2425 var useContentBgWhenLoading = false // 是否在Loading状态使用内容View的背景
2526 var enableLoadingShadow = false // 是否启用加载状态时的半透明阴影
26- var emptyText: String = " 暂无数据 "
27+ var emptyText: String = " "
2728 var emptyIcon: Int = 0
2829 var enableTouchWhenLoading = false
2930 var defaultShowLoading = false
@@ -257,9 +258,9 @@ class StateLayout @JvmOverloads constructor(context: Context, attributeSet: Attr
257258 val group = emptyView as ViewGroup
258259 (0 until group.childCount).forEach {
259260 val child = group.getChildAt(it)
260- if (child is TextView ) {
261+ if (child is TextView && child.text.isNullOrEmpty() && ! emptyText.isNullOrEmpty() ) {
261262 child.text = emptyText
262- }else if (child is ImageView && emptyIcon!= 0 ){
263+ }else if (child is ImageView && child.drawable == null && emptyIcon!= 0 ){
263264 child.setImageResource(emptyIcon)
264265 }
265266 }
0 commit comments