Posts

Showing posts from February, 2014

Table Layout

Image
Android TableLayout groups views into rows and columns. You will use the <TableRow> element to build a row in the table. Each row has zero or more cells; each cell can hold one View object. TableLayout containers do not display border lines for their rows, columns, or cells. Important Attributes for the Table Layout: Attribute Description android:id This is the ID which uniquely identifies the layout. android:collapseColumns This specifies the zero-based index of the columns to collapse. The column indices must be separated by a comma: 1,2,5 android:stretchColumns The zero-based index of the columns to stretch. The column indices must be separated by comma: 1,2,5 android:shrinkColumns The zero-based index of the columns to shrink. The column indices must be separated by comma: 1,2,5 For example, following is the content of  activity_main.xml  containing Table Layout: ...

Progress Bar

Image
We can display the progress bar dialog box to display the status of work being done like Downloading file, Loading page, etc. In this example, we are displaying the progress dialog for dummy file download. The ProgressDialog class provides methods to work on progress bar like setProgress(), setMessage(), show() etc. activity_main.xml <RelativeLayout 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"     tools:context=".MainActivity" >     <Button         android:id="@+id/button1"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_alignParentLeft="true"  ...