Arbaz Alam Arbaz Alam - 1 year ago 84
Android Question

How to draw a rectangle box around elements of Android Activity?

I want to create a rectangle box around the elements as shown in figure. Two edittext fields and a button should inside the box and outside of box is list. How can I achieve this. Kindly answer in detail because I am new in Android programming.

enter image description here

Answer Source

create a xml file in drawable like below and set it as background for your view


<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="" android:id="@+id/listview_background_shape">
    <stroke android:width="2dp" android:color="#FF0000" />
    <padding android:left="2dp"
        android:bottom="2dp" />
    <corners android:radius="5dp" />
    <solid android:color="#ffffffff" />
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download