Eclipse Error for fragment_crime_camera.xml


Using the code in [color=#4000FF]Figure 19.3 Layout for CrimeCameraFragment (fragment_crime_camera.xml)[/color]:

Eclipse does not like the android:layout_width=“0dp” for the surfaceview widget. It flags it as an error (but will still allow me to run the app):

Here it is:

<SurfaceView android:id="@+id/crime_camera_surfaceView" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" />

It also has a warning for the next line:

if I change layout_height to also be “0dp” the error and warning go away.


EDIT: the error and warning also went away after running the app. :stuck_out_tongue:


Both of those errors/warnings indicate that the parent LinearLayout has a vertical orientation. They should not appear for children of a horizontal LinearLayout.


Yea, it may have not updated its error checker thingy as I edited the file. Usually, errors go away when I do a CTL-s to save the file. This time they went away when I ran the app.

I think Android development really stresses Eclipse. At some point, it will stop writing all LogCat messages to the LogCat console, and I have to restart Eclipse to get it to work again.