I have a custom view (which extends the view group) and I specified some user attributes defined in attrs.xml ....
<declare-styleable name="datascope"> <attr name="colcount" format="integer" /> <attr name="titleheaderrows" format="integer" /> <attr name="colheaderrows" format="integer" /> <attr name="rowlayout" format="reference" /> </declare-styleable>
An integer that I can choose, but the last one is rowlayout
- I want to use it to link to another layout file, which I will inflate on demand. But I cannot find the correct way to express the rowlayout attribute in the main layout file. I tried:
lui:rowlayout="@layout/sensorvaluesdata">
but this does not execute at runtime:
E / AndroidRuntime (22092): caused by: java.lang.NumberFormatException: cannot parse 'res / layout / sensorvaluesdata.xml' as integer
and
lui:rowlayout="?layout/sensorvaluesdata"
which fails
E / AndroidRuntime (22341): caused by: java.lang.NumberFormatException: cannot parse '? 2130903043 'as a whole
This is interesting because it seems to be stuck in a resource identifier, but comes to the fore ?
.
My R.java files have a reasonable looking line for sensorvaluesdata
.
public static final class layout { public static final int sensorvaluesdata=0x7f030003; }
What is the right way to do this?
(I can write code to a java source and it works fine.
View vx = li.inflate(R.layout.sensorvaluesdata, this, false);