Thizzer
Thizzer

Reputation: 16653

Android Custom Component Properties

I have made an component for Android, which uses two drawables.

Using static values for the drawables in the code, the component works but now I want to declare the values in the properties (XML) does anyone know how to do this?

*Edit; Is there a way to do this without using the attrs.xml?

Upvotes: 0

Views: 2464

Answers (1)

CommonsWare
CommonsWare

Reputation: 1006724

You will need to set up a res/values/attrs.xml file to declare the attributes, then go through some code to retrieve those values inside of your View's constructor. I have a sample here that demonstrates the technique.

Upvotes: 4

Related Questions