vijay

welcome Netizen

Share Your Knowledge.It is a way to achieve immortality

Tuesday, August 14, 2012

Apply different border style for layout activity in android


Here I share my ideas to apply some different border style for activity that we used in android applications.
I hope that you got some basic idea about adding background style for layout activity. For your reference here I mention my previous article related to background style in android.


Let come to this article, by making border to a whole activity application get more stylish and when it run on mobile the edges will look goods.
First create one xml file in the drawable folder Here I create onel xml file bggrad.xml
Add the below code into the xml file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle" >
    <gradient
        android:endColor="#A0D3F8"
        android:gradientRadius="200"
        android:startColor="#FFF9FF"
        android:type="linear" />
    <stroke
        android:width="4dp"
        android:color="#1582BC" >
    </stroke>
</shape>

Once you created the file add the file as background for your all layout activity.main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:background="@drawable/bggrad">  
</LinearLayout>

That’s it your layout will look like below sample screen ,even if you want to apply the corner radius ,add the corner radius tag into bggrad.xml file
<corners android:topLeftRadius="40dp" android:topRightRadius="40dp"
              android:bottomLeftRadius="40dp" android:bottomRightRadius="40dp"></corners>



















Post your comments here........Happy coding

0 comments:

Post a Comment