<@U6T1F5SL9> Particulary for your view it would be...
# android
g
@ankitdroiddeveloper Particulary for your view it would be look like:
Copy code
class FreeView @JvmOverloads constructor(
  context: Context, 
  attrs: AttributeSet? = null,  
  defStyleAttr: Int = 0
) : View(context, attrs, defStyleAttr) {
    init {
       // Your code to init view
    }
}
👍 4
k
One thing we talked about in another thread where I suggested this exact same thing is that it's actually dangerous to do this.
defStyleAttr
isn't always defaulted to 0. Some classes like
EditText
require a different 3rd param. Doing this leads to very subtle bugs