Layout Params:
Layout Params are used by views to tell their parents how they want to be laid out. The basic Layout Params just describes how big the view wants to be for both width and height. For each dimension, it can specify one of -
WRAP_CONTENT:
WRAP_CONTENT will display the component big enough to just enclose it Content only. For example: If We Declare button name as "button" and set its height & width as wrap_content then it will creates button containing "button" name size and does not occupy more then its content area.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<Button
android:id="@+id/btnButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="My Button"
android:background="#008080" />
</RelativeLayout>
FILL_PARENT:
FILL_PARENT will display the component as big as its parent, and will fill in the remaining spaces. For Example, If our Parent tag has 100dp set into width and 100dp into height then it will cover our whole parent area. Parent is our first main defining Layout tag.
fill_parent Width:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<Button
android:id="@+id/btnButton1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="My Button"
android:background="#008080" />
</RelativeLayout>
fill_parent Height:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<Button
android:id="@+id/btnButton1"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:text="My Button"
android:background="#008080" />
</RelativeLayout>
fill_parent Width & Height:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<Button
android:id="@+id/btnButton1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="My Button"
android:background="#008080" />
</RelativeLayout>
MATCH_PARENT:
MATCH_PARENT is same as FILL_PARENT which display the component as big as its parent.