Created
January 23, 2018 11:38
-
-
Save douglasiacovelli/01b5fac377554a33c05b4ff8aa8db51a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class BenefitView(context: Context, attrs: AttributeSet): LinearLayout(context, attrs) { | |
| init { | |
| inflate(context, R.layout.benefit_view, this) | |
| val imageView: ImageView = findViewById(R.id.image) | |
| val textView: TextView = findViewById(R.id.caption) | |
| val attributes = context.obtainStyledAttributes(attrs, R.styleable.BenefitView) | |
| imageView.setImageDrawable(attributes.getDrawable(R.styleable.BenefitView_image)) | |
| textView.text = attributes.getString(R.styleable.BenefitView_text) | |
| attributes.recycle() | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment