Create the below form using Relative Layout.

 



<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">
<Button
        android:id="@+id/b1"
        android:text="Button1"
        android:textStyle="bold"
        android:textSize="20dp"
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"/>
<Button
        android:id="@+id/b2"
        android:text="Button2"
        android:textStyle="bold"
        android:textSize="20dp"
        android:layout_toRightOf="@id/b1"
        android:layout_marginLeft="20dp"
        android:layout_alignParentRight="true"
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"/>
<Button
        android:id="@+id/b3"
        android:text="Button3"
        android:textStyle="bold"
        android:textSize="20dp"
        android:layout_centerVertical="true"
        android:layout_height="wrap_content"
        android:layout_width="wrap_content” />
<Button
        android:id="@+id/b4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:layout_centerHorizontal="true"
        android:layout_marginLeft="26dp"
        android:layout_toRightOf="@id/b3"
        android:text="Button4"
        android:textSize="20dp"
        android:textStyle="bold" />
    <Button
        android:id="@+id/b5"
        android:text="Button5"
        android:textStyle="bold"
        android:textSize="20dp"
        android:layout_centerVertical="true"
        android:layout_alignParentRight="true"
        android:layout_marginLeft="20dp"
        android:layout_toRightOf="@id/b4"
        android:layout_height="wrap_content"/>
<Button
        android:id="@+id/b6"
        android:text="Button6"
        android:textStyle="bold"
        android:textSize="20dp"
        android:layout_height="wrap_content"
        android:layout_width="match_parent"
        android:layout_alignParentBottom="true”/>
<Button
        android:id="@+id/b7"
        android:text="Button7"
        android:textStyle="bold"
        android:textSize="20dp"
        android:layout_above="@id/b6"
        android:layout_centerInParent="true"
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"   />
</RelativeLayout>

Output:



Comments

Popular posts from this blog

Write a program to create a first display screen on any search engine using auto complete text View

Write a Program to create a toggle button to display the ON/OFF Bluetooth on the display screen.

Write a program to create a login form for social networking website.