Eclipse Graphical Layout doesn't like Include?


Last Updated:

  1. That Don Guy

    That Don Guy Member This Topic's Starter

    Joined:
    Feb 24, 2011
    Messages:
    7
    Likes Received:
    1
    I have an app where the main.xml file has an <include> tag. The app works as I expect, but whenever I try to show the main.xml's Graphical Layout tab in Eclipse, I get the error:

    You must specifiy a valid layout reference. The layout ID @layout/the_include_file is not valid.
    Couldn't resolve resource @layout/the_include_file

    even though the_include_file.xml not only exists but is in /res/layout.

    Is there a way around this, or is this just an Eclipse "feature"?
    By the way, the version information (from the About box) is:
    Version: Helios Service Release 1
    Build id: 20100917-0705

    -- Don
     

    Advertisement
  2. pietjuhhh1990

    pietjuhhh1990 Well-Known Member

    Joined:
    Feb 21, 2011
    Messages:
    235
    Likes Received:
    22
    How/what is it you are includeing?

    If you want to add a layout use

    setContentView(R.layout.yourxml);

    Do not use .xml behint the lookup onley the name of the file
     
  3. JamTheMan

    JamTheMan Well-Known Member

    Joined:
    Dec 16, 2010
    Messages:
    136
    Likes Received:
    21
    Is the the_include_file.xml actually valid android XML? I mean does it have a usable View as root and stuff?
    The include should work regardless, as long as the xml fits whereever you include it, but maybe Eclipse's GUI editor is too stricts... But as long as it works :)
     

Share This Page

Loading...