Problems using Custom Layout in XML

Posted by Kevin on Stack Overflow See other posts from Stack Overflow or by Kevin
Published on 2010-05-28T22:26:47Z Indexed on 2010/05/28 22:32 UTC
Read the original article Hit count: 188

Filed under:
|

I've created a new GridLayout class that I want to use in an XML File. The class is in another project. I've created the attrs.xml file in the other project with my properties but when the constructor gets called with the AttributeSet, none of the values are set. In my xml for my screen layout, I refer to the layout with the following: xmlns:gridLayout="@com.mastertechsoftware.AndroidUtil:http://schemas.android.com/apk/res/com.mastertechsoftware.AndroidUtil"

Not sure if that is right. I have the attrs.xml file being compiled to R.java in com/mastertechsoftware/AndroidUtil. All the right styleable values are there. In my constructor, I use: TypedArray a = c .obtainStyledAttributes(attrs, R.styleable.GridLayout); this.numRows = a.getInt(R.styleable.GridLayout_numRows, -1);

Nothing comes back (-1 does but that means nothing is there) If I use int n = a.getIndexCount(); I get 0.

© Stack Overflow or respective owner

Related posts about Xml

Related posts about android-widget