For design the layout we need to use this xml file
layout_border.xml
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<stroke android:width="2dp" android:height="2dp"
android:color="#FF0000" />
<solid android:color="#000000" />
<padding android:left="1dp" android:top="1dp" android:right="1dp"
android:bottom="1dp" />
<corners android:radius="1dp" android:bottomRightRadius="5dp"
android:bottomLeftRadius="0dp" android:topLeftRadius="5dp"
android:topRightRadius="0dp" />
</shape>
</item>
</layer-list>
and we need to set the xml file as background for the linear layout as
In the main xml
<LinearLayout android:layout_gravity="center"
android:layout_width="200dp" android:layout_height="200dp" android:background="@drawable/layout_border" />
For gradient effect you can use the below xml, this will not be in the source, you can put this file and set this as background for gradient effect
layout_gradient.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<gradient
android:startColor="#ffa5ba"
android:endColor="#ff92af"
android:angle="150"/>
</shape>
The code is fulling checked so you can run the code after downloading it itself.
You can download the full source code
Have a good day.

Excellent pieces. Keep posting such kind of information on your blog. I really impressed by your blog.
ReplyDeleteWINDOWS PHONE 7 DEVELOPMENT| Android developer|
Thanks for sharing keep updating,
ReplyDeleteHosted Ecommerce Software