Home > Android (page 2)

Android

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 onthe rating bar’s star,the selected rating ... 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 normal ... 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 the “android.widget.RadioButton” class to render the radio button, and those radio buttons are usually grouped byandroid.widget.RadioGroup. If RadioButtons are in a 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. Inside activity “onCreate()” method, attach a click ... 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 itsmeasurement 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 will ... Read More »

Android Widget – EditText

android

A EditText is an overlay over TextView that configures itself to be editable. It is the predefined subclass ofTextView 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 following sections. ... Read More »

Android Widget – TextView

android

The Android TextView component is a View subclass that is capable of showing text. Being a subclass of View the TextView the 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 ... 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: This example will take you through simple steps to show how to create your own Android application using Linear Layout and Button. First, create a layout in your layout folder. After Than Create Activity in your main src folder : Read More »

Android Widget – ListView

android

Android ListView is a view which groups several items and display them in vertical scrollable list. The list items are automatically inserted to thelist using an Adapter that pulls content from a source such as an array or database. An adapter actually bridges between UI components and the data source that fill data into UI Component. Adapter holds the data ... Read More »