Problems using Custom Layout in XML
- by Kevin
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.