Android User Interface Controls

 

Android User Interface Controls

Android User Interface controls are the online components in your app’s User Interface. Android gives a wide variety of controls you can use in your User interface for example check box, radio buttons, buttons, text area and much more.

android user interface controls

A View is actually is an object which draws anything on the screen that the consumer can interact with and a ViewGroup is a object that holds other View (and ViewGroup) toys to be able to define the layout of the customer interface.

android user interface controls

You define your layout in an XML file which provides a human-readable structure for the design, comparable to HTML. For example, a simple vertical design with a text view and a button appears like this –

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
   android:layout_width="fill_parent"
   android:layout_height="fill_parent"
   android:orientation="vertical" >
   
   <TextView android:id="@+id/text"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="I am a TextView" />
   
   <Button android:id="@+id/button"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="I am a Button" />
</LinearLayout>

 

Android User Interface Controls

There are different numbers of user interface controls provided by Google android that enable you to create the GUI ( Graphical User Interface) for your app.


Do You Have Any Question About This Tutorial? Ask Question Now On Andro Development & Get Answer Instantly. No Signup/Login Needed


Android User Interface Controls & Description

TextView

This control can be used to display wording to an client.

EditText

EditText is a predefined subclass of TextView which includes rich editing capacities.

AutoCompleteTextView

It is a view which is comparable to EditText, except that it shows a set of completion ideas automatically while the user is typing.

Button

A push-button that may be pressed, or clicked, by an client to execute an action.

ImageButton

AbsoluteLayout allows anyone to specify the precise location of its children.

CheckBox

An on/off swap that may be toggled by an client. You need to use check pack when showing users with a blended band of selectable options that aren’t mutually exclusive.

ToggleButton

Toggle Buttons is An on/off button with a light indication.

RadioButton

The RadioButton has two claims: either examined or unchecked.

RadioGroup

A RadioGroup can be used to group together one or more RadioButtons.

ProgressBar

The ProgressBar view provides aesthetic reviews about some ongoing responsibilities, such as if you are performing an activity in the background.

Spinner

Spinner is the  drop-down list which allows users to choose one value from a place.

TimePicker

The TimePicker view permits users to select a right time of the day, in either 24-hour function or AM/PM setting.

DatePicker

The DatePicker view permits users to choose a date of the day.

Create Android User Interface Controls

Input controls will be the interactive components in your app’s UI. Android offers a wide selection of controls you may use in your user interface, such as control keys, text areas, seek pubs, check boxes, move buttons, toggle switches, and so many more.

As described in previous section, a view thing may have a distinctive ID given to it that will identify the View exclusively within the tree. The syntax for an Identification, in a XML tag is –

android:id="@+id/text_id"

 

To make a android User interface Control/View/Widget you will need to explain a view/widget in the design file and assign it a distinctive ID the following –

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
   android:layout_width="fill_parent" 
   android:layout_height="fill_parent"
   android:orientation="vertical" >
   
   <TextView android:id="@+id/text_id"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="I am a TextView" />
</LinearLayout>

 

Then finally create an example of the Control thing and shoot it from the structure, use the next –

TextView myText = (TextView) findViewById(R.id.text_id);

 


Do You Have Any Question About This Tutorial? Ask Question Now On Andro Development & Get Answer Instantly. No Signup/Login Needed