Tuesday 20 November 2012

Input controls are the interactive components in your app's user interface. That are commonly used in at least every Application of Android.Also Android provides a wide variety of controls you can use in your Application's UI, such as buttons, text fields, seek bars, checkboxes, zoom buttons, toggle buttons, and many more.
And due to most famous IDE's (Eclipse, Android Studio) Adding an input control to your UI is as simple as adding an XML element to your XML layout. For example, here's a layout with a text field (EditText), TextView CheckBox, RadioButton and Button:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="|I'm TextView"
        android:textAppearance="?android:attr/textAppearanceMedium" />

    <ToggleButton
        android:id="@+id/toggleButton1"
        android:layout_width="162dp"
        android:layout_height="wrap_content"
        android:textOff="ToggleButton Off"
        android:textOn="ToggleButton On" />

    <CheckBox
        android:id="@+id/checkBox1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="I'm CheckBox" />

    <RadioButton
        android:id="@+id/radioButton1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="I'm RadioButton" />

    <Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="I'm Button" />

    <EditText
        android:id="@+id/editText1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:ems="10"
        android:hint="I'm EditText" >

        <requestFocus />
    </EditText>

</LinearLayout>



So each input control supports a specific set of input events that's why you can handle events such as when the user enters text, deletes text, touches a button or long pressed a button.Also more events you can handle.

List of Input Controls:

Here's a list of input controls that you can use in your applications for user interactions.

Note: Android provides several more controls than are listed here.If your app requires a specific kind of input control, you can build your own custom components too.

  • Button:
       A click-able or press-able button that can be pressed, or clicked, by the user to perform an action.Button consists of text or an icon (or both text and an icon) that communicates what action occurs when the user touches it.
  • CheckBox:
       An on/off switch that can be toggled by the user. You should use checkboxes when presenting users with a group of selectable options that are not mutually exclusive.
  • EditText and AutoCompleteTextView:

       An editable text field. You can use the AutoCompleteTextView widget to create a text entry widget that provides auto-complete suggestions and An EditText or AutoCompleteTextView allows the user to type text into your app. It can be either single line or multi-line. Touching a text field places the cursor and automatically displays the keyboard. In addition to typing, text fields allow for a variety of other activities, such as text selection (cut, copy, paste) and data look-up via auto-completion.

  • RadioButton And RadioGroup:
           Similar to checkboxes, except that only one option can be selected in the group.Radio buttons allow the user to select one option from a set. You should use radio buttons for optional sets that are mutually exclusive if you think that the user needs to see all available options side-by-side. If it's not necessary to show all options side-by-side, use a spinner instead.
  • ToggleButton:
          An on/off button with a light indicator And the toggle button allows the user to change a setting between two states.
  • SeekBar:
     A SeekBar is an extension of ProgressBar ( Visual indicator of progress in some operation ) that adds a draggable thumb. The user can touch the thumb and drag left or right to set the current progress level or use the arrow keys. Placing focusable widgets to the left or right of a SeekBar is discouraged.
  • Spinner:
          A drop-down list that allows users to select one value from a set. Spinners provide a quick way to select one value from a set. In the default state, a spinner shows its currently selected value. Touching the spinner displays a dropdown menu with all other available values, from which the user can select a new one.
  • Datepicker and TimePicker:

       These are the dialog boxes for users to select a single value for a set by using up/down buttons or via a swipe gesture. So you can Use DatePicker widget to enter the values for the date (month, day, year) or a TimePicker widget to enter the values for a time (hour, minute, AM/PM), which will be formatted automatically for the user's locale.