1. Check out our companion app, Forums for Android! Download from Google Play

XML ViewFlipper accessing other XMLs directly?

Discussion in 'Application Development' started by That Don Guy, Mar 1, 2011.

  1. That Don Guy

    That Don Guy Member
    Thread Starter
    6

    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
    38

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