diff --git a/app/src/main/java/com/lxj/demo1/MainActivity.kt b/app/src/main/java/com/lxj/demo1/MainActivity.kt index 5ef64e8..9fbc6ec 100644 --- a/app/src/main/java/com/lxj/demo1/MainActivity.kt +++ b/app/src/main/java/com/lxj/demo1/MainActivity.kt @@ -106,7 +106,7 @@ class MainActivity : AppCompatActivity() { emptyIcon = R.mipmap.ic_launcher_round, loadingLayoutId = R.layout.custom_loading2, errorLayoutId = R.layout.custom_error, - emptyLayoutId = R.layout.custom_empty +// emptyLayoutId = R.layout.custom_empty ) { slInLayout.postDelayed({slInLayout.showEmpty()}, 1000) } slInLayout.showLoading() slInLayout.postDelayed({slInLayout.showContent()}, 2000) diff --git a/statelayout-library/src/main/java/com/lxj/statelayout/StateLayout.kt b/statelayout-library/src/main/java/com/lxj/statelayout/StateLayout.kt index ba9fc8c..52d142b 100644 --- a/statelayout-library/src/main/java/com/lxj/statelayout/StateLayout.kt +++ b/statelayout-library/src/main/java/com/lxj/statelayout/StateLayout.kt @@ -262,9 +262,9 @@ class StateLayout @JvmOverloads constructor(context: Context, attributeSet: Attr val group = emptyView as ViewGroup (0 until group.childCount).forEach { val child = group.getChildAt(it) - if(child is TextView && child.text.isNullOrEmpty() && !emptyText.isNullOrEmpty()) { + if(child is TextView && !emptyText.isNullOrEmpty()) { child.text = emptyText - }else if(child is ImageView && child.drawable==null && emptyIcon!=0){ + }else if(child is ImageView && emptyIcon!=0){ child.setImageResource(emptyIcon) } } diff --git a/statelayout-library/src/main/java/com/lxj/statelayout/StateLayoutConfig.kt b/statelayout-library/src/main/java/com/lxj/statelayout/StateLayoutConfig.kt index b822d15..4a6ba1e 100644 --- a/statelayout-library/src/main/java/com/lxj/statelayout/StateLayoutConfig.kt +++ b/statelayout-library/src/main/java/com/lxj/statelayout/StateLayoutConfig.kt @@ -7,7 +7,7 @@ object StateLayoutConfig { var animDuration = 120L var useContentBgWhenLoading = false //是否在Loading状态使用内容View的背景 var enableLoadingShadow = false //是否启用加载状态时的半透明阴影 - var emptyText: String = "暂无数据" + var emptyText: String = "" var emptyIcon: Int = 0 var enableTouchWhenLoading = false var defaultShowLoading = false