android - Creating activity with 3 fragments -
I currently have an application for my phone that uses a tab navigation taskbar to navigate between three pieces Does.
Now I want to make the tablet equivalent of this app, but instead of using the proceedings, I want the three pieces that are next to each other so that each piece filled with 1/3 of the screen. Will go
The problem is, how can I understand how to contact it. I have thought about using the design section of Android Studio to create placeholders, then use the onCreate ()
method to fill those placeholders with pieces in it
You can create 3 placeholders of one third of the screen, Can fill with Of course you only have to make them in the layout for tablets.
piece slice 1 = new firstfragment (); Piece volume 2 = new seconds fragment (); Piece volume 3 = new third paragraph (); GetSupportFragmentManager () .beginTransaction () .replace (Rid.placeholder1, fragment1) .replace (Rid.placeholder2, fragment2) .replace (Rid.placeholder3, fragment3) .commit ();
Edit: Example of Layout
& Lt; FrameLayout Android: ID = "@ + ID / Placeholder 2" Android: layout_weight = "1" Android: layout_width = "0dp" Android: layout_hete = "match_perrent" /> & Lt; FrameLayout Android: ID = "@ + ID / Placeholder 3" Android: layout_weight = "1" Android: layout_width = "0dp" Android: layout_height = "match_parent" /> & Lt; / LinearLayout & gt;
Comments
Post a Comment