Skip to content

Instantly share code, notes, and snippets.

@dnnyg33
Last active March 23, 2020 18:17
Show Gist options
  • Save dnnyg33/8a1d7f96c03ca81f2976cfce38366831 to your computer and use it in GitHub Desktop.
Save dnnyg33/8a1d7f96c03ca81f2976cfce38366831 to your computer and use it in GitHub Desktop.
File template for Kotlin Custom view
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.widget.FrameLayout
import com.tengentllc.scripturegames.R
class ${NAME}(context: Context, attrs: AttributeSet?) : FrameLayout(context, attrs) {
constructor(context: Context) : this(context, null)
init {
LayoutInflater.from(context).inflate(getLayoutId(), this, true)
}
private fun getLayoutId(): Int {
return R.layout.$xml_layout
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment