StateView icon indicating copy to clipboard operation
StateView copied to clipboard

wrap(View),父为LinearLayout时,会导致View总是最后一个

Open engun opened this issue 7 months ago • 4 comments

@JvmStatic
fun wrap(view: View): StateView {
    val parent = view.parent
    if (parent is ViewGroup) {
       ...
        val wrap = FrameLayout(view.context)
        // 似乎应该处理 index
        parent.addView(wrap, view.layoutParams)
        ...
        return stateView
    }
    throw ClassCastException("view.getParent() must be ViewGroup")
}

engun avatar Jun 09 '25 08:06 engun

顺便说下,lib很好用,致敬

engun avatar Jun 09 '25 08:06 engun

当时 wrap 方法应该没考虑过 LinearLayout,因为很少用 LinearLayout,用到了也没想过用 wrap; 是的,处理了 index 就没问题了

nukc avatar Jun 10 '25 04:06 nukc

LinearLayout 还是比较常用的。

engun avatar Jun 11 '25 04:06 engun

v3.0.3 已经发布了

nukc avatar Jun 11 '25 08:06 nukc