maoruibin / maoruibin.github.com

personal blog
http://gudong.site
MIT License
21 stars 5 forks source link

用代码为 View 设置波纹背景 #70

Open maoruibin opened 6 years ago

maoruibin commented 6 years ago
//设置波纹背景
        val typedValue = TypedValue()
        this.theme.resolveAttribute(android.R.attr.selectableItemBackground, typedValue, true)
        val attribute = intArrayOf(android.R.attr.selectableItemBackground)
        val typedArray = this.theme.obtainStyledAttributes(typedValue.resourceId, attribute)
        tipView.background = typedArray.getDrawable(0)

链接:自定义控件属性以及代码设置selectableItemBackground - CSDN博客