In this module, we have been further introduced to working with various resource files to create activity layouts for an Android application. What are the various layouts that are created when a...

1 answer below »
In this module, we have been further introduced to working with various resource files to create activity layouts for an Android application. What are the various layouts that are created when a developer utilizes the Fragment option in the Android Design Support Library? What are the components of each created layout? How can these layouts be used (provide an example for each layout)?Support your statements with logic and argument, citing any sources referenced.
Answered Same DayMay 06, 2021

Answer To: In this module, we have been further introduced to working with various resource files to create...

Riya answered on May 07 2021
135 Votes
ASSIGNMENT
A layout defines the structure for user interface in the application .A lot of things depend on the layout selected for the application .For example, whether the buttons in the app will be aligned under each other or side by side depends on the layout used .There are a number of layouts provided by android namely:
· Linear Layout
· Relative Layout
· Table Layout
· Absolute Layout
· Fra
me Layout
· Constrain Layout
· Grid Layout
· Coordinator Layout
Android makes the User Interface of the application good by using XML and various view components .The view components plays an important role in designing the layouts of the app . View is the superclass of all the UI components.
The various UI components are:
· Textview :To add text in the application.
· EditText :This is utilized when user input is required to be taken.
· ImageView :To add image in the application.
· ProgressBar :To show the progress of something.
· Image Button :Used to make the image inserted in the application clickable like a button.
· CheckBox :It is used to select multiple options.
· DatePicker :To select a particular Date.
The layouts can be used as follows:
· Linear Layout-This layout aligns all components in a single direction, i.e. vertically or horizontally.
Example:To Design a Messaging app with 3 user inputs namely:To,Subject,Message and a send button aligned under each other in a vertical manner we write the following code.

android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/subject"/>
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="top"
android:hint="@string/message"/>
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:text="@string/send"
/>
· Relative Layout :It displays the views in relative positions.
Example:For placing Button 1 to Button 7 relative to each other.

android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="10dp"
android:paddingRight="10dp">
android:id="@+id/btn1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:text="Button1" />
android:id="@+id/btn2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:text="Button2" />
android:id="@+id/btn3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:text="Button3" />
android:id="@+id/btn4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:text="Button4" />
android:id="@+id/btn5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/btn2"
android:layout_centerHorizontal="true"
android:text="Button5" />
android:id="@+id/btn6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/btn4"
android:layout_centerHorizontal="true"
android:text="Button6" />
...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here