1. Download our Official Android App: Forums for Android!

Apps Eclipse Graphical Layout doesn't like Include?

Discussion in 'Android Development' started by That Don Guy, Mar 3, 2011.

  1. That Don Guy

    That Don Guy Lurker
    Thread Starter
    Rank:
    None
    Points:
    6
    Posts:
    7
    Joined:
    Feb 24, 2011

    Feb 24, 2011
    7
    1
    6
    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
    Rank:
    None
    Points:
    38
    Posts:
    235
    Joined:
    Feb 21, 2011

    Feb 21, 2011
    235
    22
    38
    App/web development
    Netherlands
    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
    Rank:
    None
    Points:
    38
    Posts:
    136
    Joined:
    Dec 16, 2010

    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...