Android Sample Coding-PART 3:
1.Toast:
Toast is a notification message that pop up, display a certain amount of time, and automatically fades in and out, most people just use it for debugging purpose.
//display in short period of time Toast.makeText(getApplicationContext(), "msg msg", Toast.LENGTH_SHORT).show(); //display in long period of time Toast.makeText(getApplicationContext(), "msg msg", Toast.LENGTH_LONG).show();
Screenshot :
1.1. Normal Toast :
1.2.Custom Toast:
Download Code Here
Normal Toast
Custom Toast
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2.Alert Dialog:
Alert Dialog class can be used,where a message and one,two or three buttons are displayed in a popup window.
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder( context);
Screenshot :
Download Code Here
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3.Custom Dialog:
Custom Dialog is usually a small window that appears in front of the current Activity. The underlying Activity loses focus and the dialog accepts all user interaction. Dialogs are normally used for notifications that should interrupt the user and to perform short tasks that directly relate to the application in progress (such as a progress bar or a login prompt).
AlertDialog.Builder builder = new AlertDialog.Builder(this);
Screenshot :
Download Code Here
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4.List View:
List View arranges components in a vertical scroll able list.
Screenshot :
Download Code Here
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4.1. Custom ListView:
Custom ListView is explained how to design listview with your custom styles and colors instead of using default listview style.
Screenshot :
Download Code Here
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4.2. Expandable List View:
Expandable List View is used to group list data by categories. It has the capability of expanding and collapsing the groups when user touches header.
Screenshot :
Download Code Here
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4.3. Search In List View:
Adding search functionality to listview will filters the list data with a matching string, hence provides user an easy way to find the information he needs.
Screenshot :
Download Code Here
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5.Scroll View:
Scroll View Layout container for a view hierarchy that can be scrolled by the user, allowing it to be larger than the physical display. A ScrollView is a FrameLayout, meaning you should place one child in it containing the entire contents to scroll; this child may itself be a layout manager with a complex hierarchy of objects.
Screenshot :
Download Code Here
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6. Horizontal Scroll View:
Horizontal Scroll View Layout container for a view hierarchy that can be scrolled by the user, allowing it to be larger than the physical display. A ScrollView is a FrameLayout, meaning you should place one child in it containing the entire contents to scroll; this child may itself be a layout manager with a complex hierarchy of objects.
Screenshot :
Download Code Here
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
No comments:
Post a Comment