Author Archives: jkoder

Android Widget – Spinner

android

Android spinners are not nothing but the dropdownlist seen in other programming languages. It provides a easy way to select value from list. Clicking spinner will display a dropdownlist with the available values. In this tutorial, we show you how to do the following tasks : 1.Render a Spinner in XML, and load the selection items via XML file also. ... Read More »

Android Widget – Rating Bar

android

In Android, you can use “android.widget.RatingBar” to display rating bar component in stars icon. The user is able to touch, drag or click on the stars to set the rating value easily. In this tutorial, we show you how to use XML to display a rating bar, few textviews and a button. When user click on the rating bar’s star,the ... Read More »

Android Widget – ToggleButton

android

In Android, the “android.widget.ToggleButton” is a special class to render a button which has only two states, for example, “on” and “off”. It’s best alternative to radio buttons to turn on or turn off a function. In this tutorial, we show you how to use XML to create two toggle buttons and a normal button, when user click on the ... Read More »

Android Widget – CheckBox

android

In Android, you can use “android.widget.CheckBox” class to render a checkbox. In this tutorial, we show you how to create 3 checkboxes in XML file, and demonstrates the use of listener to check the checkbox state – checked or unchecked. Open “your.xml” file, just add add 3 “CheckBox” and a button, inside the LinearLayout. <!--?xml version="1.0" encoding="utf-8"?--> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" ... Read More »

Android Widget – RadioButton & RadioGroup

android

In Android, you can use “android.widget.RadioButton” class to render radio button, and those radio buttons are usually grouped by android.widget.RadioGroup. If RadioButtons are in group, when one RadioButton within a group is selected, all others are automatically deselected. Open “your.xml” file, just add “RadioGroup”, “RadioButton” and a button, inside the LinearLayout. <!--?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">     <radiogroup ... Read More »

Android Widget – ImageButton

android

An ImageButton is an AbsoluteLayout which enables you to specify the exact location of its children. This shows a button with an image (instead of text) that can be pressed or clicked by the user. Add ImageButton Open “your.xml” file, just add an ImageButton . Creating a ImageButton in a Layout File <!--?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"> ... Read More »

Android Widget – ImageView

android

The ImageView class can load images from various sources (such as resources or content providers), takes care of computing its measurement from the image so that it can be used in any layout manager, and provides various display options such as scaling and tinting. Add ImageView Open “your.xml” file, just add an ImageView and Button for demonstration. By default, imageView1 ... Read More »

Android Widget – EditText

android

A EditText is an overlay over TextView that configures itself to be editable. It is the predefined subclass of TextView that includes rich editing capabilities. Creating a EditText You can create a EditText instance either by declaring it inside a layout XML file or by instantiating it programmatically. Below example will cover both ways of creating a EditText in the ... Read More »

Android Widget – TextView

android

The Android TextView component is a View subclass which is capable of showing text. Being a subclass of View the TextView component can be used in your Android app’s GUI inside a ViewGroup, or as the content view of an activity. Creating a TextView You can create a TextView instance either by declaring it inside a layout XML file or ... Read More »

Android Widget – Button

android

A Button is a Push-button which can be pressed, or clicked, by the user to perform an action. Button Attributes: android:autoText - If set, specifies that this TextView has a textual input method and automatically corrects some common spelling errors. android:drawableBottom - This is the drawable to be drawn below the text. android:drawableRight - This is the drawable to be ... Read More »