How to build a simple user interface in android apps
In my previous lesson, we learn how to run Android applications.Today we are going to a simple user interface.We will add TextView, linearlayoutButtons, etc.
Android graphical user interface is made up of Views(Buttons and Textfields) and ViewGroup.
Layout subclasses are contained in the ViewGroup.This exercise linear layout.
Diagram showing View group in a layout
Steps to simple user interface in Android
Open android Studio project and go to app > res > layout > activity_main.xml.
This file defines your application Layout.
Delete all the content and add below XML file.
There are two attributes that are very import here.
match_parent attribute makes the layout to occupy the whole screen.
2.Adding TextFields to the Layout.
activity_main.xml file ,add the following elements .All of them are EditText.All of them takes string variables.TextFields to be added Name,Email and Message.
Dont worry about the error that appears because of android:hint=”@string/edit_message” and others.They will be fixed once we add string Resources.
3.Add String Resources:
In your project window,open res > values > strings.xml. and add below code.
This is the last step.Add below button code to activity_main.xml file.
Once you run your application you should see below screen on your device.