Reputation: 31
I am developing application in android.What I want is ,my activity should represent two xml layouts files.concept is like, ->when the activity is started it should show one layout(screen) ->when I click on the button exist on the first layout, it should show 2nd layout in the bottom of the screen,keeping first layout visible.
Upvotes: 0
Views: 2264
Reputation: 5442
On method to call two xml files in on activity is by using layoutmanager and assign the screen ratio for both xml files. Use relative layout in both xml. Small code snippet is
RelativeLayout layleft = (RelativeLayout)inf.inflate(R.layout.firstxml,null);
RelativeLayout layright = (RelativeLayout)inf.inflate(R.layout.secondxml,null);
for detail info Layout Reuse help
Upvotes: 1
Reputation: 6532
you can try use the bellow example:
https://github.com/AdilSoomro/Iphone-Tab-in-Android
this source code to change layout like button click to load another layout!
Upvotes: 0
Reputation: 4497
For this you have to use the concept of visibility. Initially set visibility of second layout as GONE and when you press button set Its visibility True.
Upvotes: 0
Reputation: 18592
Have both the layout in a single XML. Keep the visibility of the the second layout to secondLayoutObject.setVisibility(View.GONE)
initially and then on the click of the button change its visibility to secondLayoutObject.setVisibility(View.Visible)
.
Upvotes: 4