Reputation: 1382
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.
Upvotes: 2
Views: 14067
Reputation: 85
I would suggest FIRST wrapping your elements in a layout (as suggested by Josue de Leon Santana), then creating a custom background for that layout (similar to what SaravInfern suggested).
That custom background can have all your desired design preferences.
Hope this helps anyone else needing to do this!
Upvotes: 2
Reputation: 134
You need to wrap those elements in a layout. An example would be to have a LinearLayout with orientation = vertical, and the background the color that you want.
Upvotes: 3
Reputation: 3388
create a xml file in drawable like below and set it as background for your view
rectanglebg.xml
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/listview_background_shape">
<stroke android:width="2dp" android:color="#FF0000" />
<padding android:left="2dp"
android:top="2dp"
android:right="2dp"
android:bottom="2dp" />
<corners android:radius="5dp" />
<solid android:color="#ffffffff" />
</shape>
Upvotes: 4