【发布时间】:2021-08-27 15:47:56
【问题描述】:
嘿,我试图在自定义视图类中传递参数。它给出警告 Custom view ChipTabView is missing constructor used by tools: (Context) or (Context,AttributeSet) or (Context,AttributeSet,int)。我不想使用 suppressLint 如何删除此警告有人可以帮助我。我试过这个Custom view is missing constructor used by tools for adapter 我不想更改android studio的设置。我需要适当的解决方案如何以干净的方式实现这一目标。提前致谢
class ChipTabView @JvmOverloads constructor(
context: Context,
private val number: Int,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : View(context, attrs, defStyleAttr) {
【问题讨论】: