Create an application with multiple Fragments.
Create a new Android Application using the EMPTY Template. Select API 21 (Android 5.0) as the Minimum SDK.
Create three Blank Fragment Java classes - Small, Medium, and Large
For the Main Activity, create a Layout with the following elements:
Two frames splitting the screen in half; use a layout element such as a with orientation="vertical" or else use a Constraint Layout.
The top frame will be part of the main activity (although it could be another fragment if you want). The bottom frame will hold a fragment based on which button is pressed, but it will start out empty.
In the activity_main Layout for the top, add an EditText field and buttons : [SMALL] [MEDIUM] [LARGE]
Colour the background of this fragment with a colour of your choice.
In the layouts for each Fragment, create a unique background colour (different for each), and a centred TextView that is sized 14dp for the small, 20dp for medium, and 40dp for the large display.
When a Button is clicked, attach the matching Small, Medium,or Large Fragment to the bottom frame of the layout, and copy the text contents from the EditText into the TextView in the Fragment.
You will need to attach your fragments using code (FragmentManger/FragmentTransaction). Make sure you use fragment transaction .replace() to prevent crashes or duplicate adds.
You can transfer the EditText string to your Fragments by whatever valid method you choose, for example global variables, Bundle, or an Interface.
To center the TextView vertically and horizontally, use android:gravity="center"
When the app starts, there is no fragment attached:
When SMALL, MEDIUM, or LARGE is pressed, the appropriate Fragment is attached & filled with the text:
5 freelancers are bidding on average $83 for this job
My name is Thomas, and you may find more about me at [url removed, login to view] [url removed, login to view] & [url removed, login to view] Relevant Skills and Experience My skills are Swift, Objective C and PHP [url removed, login to view] framework More