Sunday, 11 November 2012

Drag & Drop Elements in FORM WIDGET



Hai friends,in this chapter i am going to discuss about the different drag & drop elements used in ANDROID.Basically the designing in android is typically very easy but the coding part is very hard to implement.

        Lets examine the different elements in Graphical Layout in the ANDROID. In this chapter we are discussing about the FORM WIDGETS.The bellow figure shows the elements in the form widget.


The different elements in the Form widgets are.

TextView
  • TextView is used to display text to the user and allows them to edit it.
  • TextView is said to be a complete text editor.
  • It is available in 3 size Large,Medium and small.
  • The default code in main.xml will be in given bellow.
<TextView
            android:id="@+id/textView2"
              android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                  android:text="TextView" 
          />
               
            Button
            • Button represents a push button widget.The push button can be clicked or pressed by the user for performing an action:
            • The default code in main.xml will be in given bellow

            <Button

                    android:id="@+id/button1"

                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Button" 
            />

            Toggle Button

            • Toggle button displays checked or unchecked states as a button by a light indicator and default text appear in the button is ON or OFF.
            • The default code in main.xml will be in given bellow

            <ToggleButton

                    android:id="@+id/toggleButton1"

                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="ToggleButton" 
            />

            CheckBox

            • A checkbox is a specific type of two-states button that can be either checked or unchecked.
            • The default code in main.xml will be in given bellow.

            <CheckBox

                    android:id="@+id/checkBox1"

                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="CheckBox"
             />

            RadioButton
            • A radio button is a two-states button that can be either checked or unchecked. 
            • When the radio button is unchecked, the user can press or click it to check it. 

            • Radio buttons are normally used together in a RadioGroup
            • When several radio buttons live inside a radio group, checking one radio button unchecks all the others.
            • The default code in main.xml will be in given bellow.

             <RadioButton

                    android:id="@+id/radioButton1"

                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="RadioButton" 
            />
            Spinner
            • A view that displays one child at a time and lets the user pick among them.
            • The items in the Spinner come from the Adapter associated with this view
            • The default code in main.xml will be in given bellow.

                <Spinner
                    android:id="@+id/spinner1"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
              />

            ProgressBar
            • Visual indicator of progress in some operation. 
            • Displays a bar to the user representing how far the operation has progressed
            • The application can change the amount of progress as it moves forward.
            • Progress Bar of 3 types,large,small and horizontal size.
            • The default code in main.xml will be in given bellow.
            <ProgressBar
                    android:id="@+id/progressBar1"
                    style="?android:attr/progressBarStyleLarge"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
             />

            SeekBar
            • A SeekBar is an extension of ProgressBar 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.
            • The default code in main.xml will be in given bellow.
            <SeekBar
                    android:id="@+id/seekBar1"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
             />
               

            QuickContactBadge
            • Widget used to show an image with the standard QuickContact badge and on-click behavior.
            • The default code in main.xml will be in given bellow.
             <QuickContactBadge
                    android:id="@+id/quickContactBadge1"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
             />
               

            RadioGroup
            • This class is used to create a multiple-exclusion scope for a set of radio buttons.
            • Checking one radio button that belongs to a radio group unchecks any previously checked radio button within the same group.
            • Intially, all of the radio buttons are unchecked. 
            • While it is not possible to uncheck a particular radio button, the radio group can be cleared to remove the checked state.
            • The selection is identified by the unique id of the radio button as defined in the XML layout file.
            • The default code in main.xml will be in given bellow.
            <RadioGroup
                    android:id="@+id/radioGroup1"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" >

                    <RadioButton
                        android:id="@+id/radio0"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:checked="true"
                        android:text="RadioButton" />

                    <RadioButton
                        android:id="@+id/radio1"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="RadioButton" />

                    <RadioButton
                        android:id="@+id/radio2"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="RadioButton" />

                </RadioGroup>


            RatingBar
            • A RatingBar is an extension of SeekBar and ProgressBar that shows a rating in stars. 
            • The user can touch/drag or use arrow keys to set the rating when using the default size RatingBar.
            •  The smaller RatingBar style and the larger indicator-only style  do not support user interaction and should only be used as indicators.
            • When using a RatingBar that supports user interaction, placing widgets to the left or right of the RatingBar is discouraged.
            • The default code in main.xml will be in given bellow.



            In the next chapter we will discuss about the elements in the text fields

            "Your comments and suggestions please"

            1 comments:

            Roney Joseph said...

            This post is very relavant to know about the drag and drop elements