Pass custom attributes to custom classes (via XML resources)

Tutorials with advanced 'difficulty' and more Lines of Code.

Pass custom attributes to custom classes (via XML resources)

Postby biosopher » Sat May 03, 2008 12:18 am

If you're doing any UI development and have created your own extensions of View (e.g. Button, Layout, ...), then this tutorial is for you.

Ever wonder how to create your own attributes (like android:layout_width="fill_parent") so you can keep your custom View elements UI attributes in your XML? After much avoiding of the problem myself, I finally found the answer with the help of fellow AndDev members.

I posted a quick tutorial on how to do this (create & pass custom attributes from the resource XML file to the Class's constructor) on my blog. As I'm a fairly advanced developer myself, yet didn't know the answer until recently, I decided to post the solution in this advanced tutorial section:

Passing custom attributes tutorial (via XML resource files)

Posts: 26
Joined: Sat Mar 15, 2008 8:14 pm
Location: San Francisco, California


Return to Advanced Tutorials

Who is online

Users browsing this forum: No registered users and 1 guest