Layout

Android Layout Padding

In android, we can set Padding to layout. So that for each view we can give some space to display.

Android Layout Background Image

Now we are going to see about android layout background image. Also you can check our previous post about the android layout background color.

In android, we can set a image to layout as background by using background property in layout.

Android Layout Highlight

In android, we can't have option to highlight the layout directly.

Android Layout Background Color

In android, we can set the layout background color using background property in layout.
Example for Layout Background Color :-
[sourcecode language="xml"]
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:id="@+id/LinearLayout01"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:background="#0000ff" />
[/sourcecode]
The output will looks like

Android Textview Border

We cannot set border to textview directly because there is no property to set border for textview.

But we can give background color to Tablelayout & Textview.

Android Button Size

We can set Android button size manuallly by using the button property 'android:layout_height' & 'android:layout_width'.

Android RelativeLayout

RelativeLayout:

What are the uses of Relative layout?

  • By adding views to relative layout, we can set the relative positions of views with respect to each other.
  • For example if we add three views like imageview, textview and edittext we can specify the position of textview, that is whether it should be below (or any other direction) to edittext or imageview.
  • android:layout_above=”@+id/idname” (Here ”@+id/idname” is the id name of th

Android TableLayout

TableLayout:

By seeing the word ‘Table’ itself we know that Table Layout is used to show views in a table format with rows & columns.

How to add rows in a table layout?

  • TableRow is used to add rows in a table layout.
  • TableRow is a layout. It will arrange its children horizontally.

Android Textview Tutorial

In this tutorial, we are going to learn about TextView.

In Android if we start any application, we may need to use TextView.

Textview is a View which we can add to any Layout.

How to add TextView in a Layout?

To add a textview to a layout, select the layout you need to add (here I have selected LinearLayout01) & then click the Add Button (shown in green color with plus symbol intimating "Adds a new element")

Syndicate content