Answer the question
In order to leave comments, you need to log in
Support for tablets (display 2 fragments)?
How to correctly implement support for the tablet version with a making structure:
There is a base activity from which all my other activities rely.
Let's say 1 activity passes the layout to the base and the fragment (A) that will open. It is necessary to make it so that in 1/3 of the screen there was that fragment A and in 2/3 that the detailing of the list (fragment B) would open. How to implement it? I understand that creating a layout that will place containers and load those fragments there, but share the material on how to do everything correctly and beautifully.
+ what to do with the implementation (with code) of a simple version (portrait) if so, fragments are replaced in 1 container ....
Sorry if I wrote something wrong! I will be very grateful!!!
Answer the question
In order to leave comments, you need to log in
Here is the source for the working example you need.
Taken from this book ( can be found online ).
In short:
1) Create two versions of layout
yours Activity
(one in the folder layout
( for smartphones ), and the other in the folder - layout-large
( for tablets )). layout
For tablets, insert not only fragment
with your list of options, but also FrameLayout
to display information on the object from the list.
2) In the class Activity
on clicking on an element of the list of options, write something like this code:
if (myFrameLayout != null) { // FrameLayout существует только в layout для планшетов
showInforamtionAtDetailFragment(); //поэтому если он существует - показываем информацию во фрагменте
else {
openDetailActivity(); // иначе - у нас смартфон, потому что layout не существует;открываем отдельную Activity
}
An example of what you want: developer.android.com/intl/ru/guide/components/fra...
Smoke this, retelling the contents of the docks without specific questions and problems is a little expensive.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question