获取安卓控件背景色

private fun getBackgroundColor(): Int {
    var bgColor = Color.parseColor("#000000")
    if (backgroundColorTv.background is ColorDrawable) {
        val colorDrawable = backgroundColorTv.background as ColorDrawable
        bgColor = colorDrawable.color
    }
    return bgColor
}
发布了390 篇原创文章 · 获赞 65 · 访问量 34万+

猜你喜欢

转载自blog.csdn.net/yinxing2008/article/details/104049743