Homework 1: Biography viewer App GUI
Create a new project (use minSDK API 27) and modify the default activity according to the following specification.
Part 1: Portrait Mode
There is a ConstraintLayout- based Activity that should have 4 objects (2 pts):
- One ImageView displaying a drawable image resource
- A TextView, which displays the value defined in a String resource xml
- Two buttons, with hardcoded text values instead of string resources
- The values should be "Next" and "Previous".
Use an image and text of your own choice, but text should be at least 200 chars long.
- The TextView should have 2 vertical and 2 horizontal constraints to the parent so that it is vertically & horizontally centered on the screen.
- The ImageView should have 2 horizontal constraints to the parent so that it is horizontally centered, its bottom should be constrained to the top of the TextView, while its top should be constrained to the top edge of the screen.
- Both buttons should be vertically constrained only to the bottom of the screen
- The "Previous" button should have 1 horizontal constraint to the left edge of the screen
- The "Next" button should have 1 horizontal constraint to the right edge.
![](https://courses.cs.ut.ee/2020/MCIoT/fall/Main/Homework1?action=download&upname=hw1_portrait.png)
Adjust the widths and height attributes to either wrap_content or match_parent to obtain the above result. Do not use hardcoded numeric values other than 0dp (which is equivalent to match parent)
Part 2: Landscape Mode
- Create a second activity layout file for Landscape mode, which uses LinearLayout (1pt)
- Place the same 4 elements in the layout.
- Using XML attributes of the elements, adjust the elements so that:
- The LinearLayout uses a "horizontal" value for "orientation"
- All of them are vertically centered (layout_gravity) (1pt)
- Distribute the items horizontally using weight (1pt):
- Set the layout_width of each element to 0dp
- Set the weights of the buttons so each button takes 10% of the display horizontally
- Set the weights of the ImageView and TextView so that each takes 40% horizontally
![](https://courses.cs.ut.ee/2020/MCIoT/fall/Main/Homework1?action=download&upname=hw1_landscape.png)
When you run your application and rotate the device, the App should switch between the two activity layout files!