Hmm ...
I am subclassing the view as an inner class in my work. Before I just get attached to this view from my work, do the following:
setContentView(new CustomView(this));
no problem.
Now, however, my presentation is becoming more complex, so I am making it part of FrameLayout so that I can make it a basic view and add a Spinner widget on top of it. The problem is that when I do this, I get an error message:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.grafightscratch.ochemmer/com.grafightscratch.ochemmer.MoleculeTablet}: android.view.InflateException: Binary XML file line
So, this view worked until when I directly contacted it, but when I tried to add it to the main.xml file as part of the framework, I got the above error. I also tried to insert the layout, only displaying it through:
<com.grafightscratch.ochemmer.MoleculeTablet.MoleculeTabletView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/molecule_tablet_view" android:layout_width="fill_parent" android:layout_height="fill_parent" />
Nothing works. I keep getting InflateException / ClassNotFoundException errors. He complains about "line number 3" in the binary XML file, and if it comes to main.xml, which is a package declaration that I checked three times.
EDIT I tried to make this view a separate class (i.e. Not an inner class) and it works. After some searching, I found a few posts saying that the xml tag should look like this:
<com.grafightscratch.ochemmer.MoleculeTablet$MoleculeTabletView ...>
That is, the dollar sign should be used for the branch of the inner class from the main class. However, Eclipse barfs on this, calls it a bug and refuses to let me create or deploy with this symbol. So now the question is: how does the view, which is an inner class, refer to?
android layout view
IcedDante Jan 20 '10 at 0:44 2010-01-20 00:44
source share