User Interface (UI) design in Android is a graphical representation of views displayed on a smartphone or tablet. It allows users to interact with the features, functions, and contents of the application.
To design UI, you need no prior programming knowledge, although it is nice to have web developing skills or programming skills.
Every application has a user interface with which users can interact. Android provides various
There are many components for the Android application. Let’s consider a few of them here:
Main Action Bar (MAR)
Split Action Bar (SAB)
Content Area
These play a significant role while developing a complex Android application.
What is View?
Views are used to customize User Interface (UI) design. A view is considered a building block for a proper User Interface created from the view class.
A view can also be defined as a small rectangular box in Android development that responds to the user inputs, for example, buttons, checkboxes, etc. Basically, a View is what a user sees and interacts with.
View group is an invisible container of other views, such as child view and other view groups. This view class is a super class of all the
Figure 1.0. A simple UI Design
In the Android studio, we commonly use a view called “edit text and images”. Images are classified as widgets used to create an interactive UI component, such as buttons, text fields, etc.
The Layout defines the visual structures of the UI of user application. All elements in the layout are built using a hierarchy of views and view group object.
The layout can be declared through a programming language, or through a simple XML layout file located in the resource layout folder of any project you work on. Android provides a straightforward XML vocabulary that corresponds to the view class and subclasses, such as those present for widget and layout. Due to this, the layout can be treated.
Layouts are kept in the folder called resources. Android studio creates a default XML layout file in the resources layout folder that is extremely useful if you know the basic at the time of compiling.
Figure 1.1. A simple layout with imageView
There are many advantages of XML layout. These are:
Android provides a number of layouts, that provide different views, to use in its applications.
The following are considered the standard layouts or view groups used in Android applications.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello, I am a Button" />
</LinearLayout>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello, I am a Button" />
</FrameLayout>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello, I am a Button" />
</RelativeLayout>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello, I am a Button" />
</TableLayout>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello, I am a TextView" />
</androidx.constraintlayout.widget.ConstraintLayout>
There are a number of measurement units used in Android studio.