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

Apps XML ViewFlipper accessing other XMLs directly?

Discussion in 'Android Development' started by That Don Guy, Mar 1, 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
    Is there a way for an XML file to access the contents of other XML files directly?

    That is, I have a ViewFlipper defined in main.xml, and two other layouts defined in other files (page1.xml and page2.xml). Is there a way to put into main.xml something that indicates that the ViewFlipper's two child views are in page1.xml and page2.xml, or do I have to do this in Java (presumably in the app's OnCreate(), with separate addView calls for both page1 and page2)?

    -- Don
     

    Advertisement

  2. JamTheMan

    JamTheMan Well-Known Member
    Rank:
    None
    Points:
    38
    Posts:
    136
    Joined:
    Dec 16, 2010

    You can use the <include> tag to re-use layout.xml files inside other layouts.

    Code (Text):
    1.  
    2. <include
    3.     layout="@layout/other.xml"
    4. />
    5.  
     

Share This Page

Loading...