Tuesday 15 May 2012

Round Corner LinearLayout in Android

main.xml:-


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
     >

  <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="100dp"
        android:layout_margin="15dp"
        android:background="@drawable/myshape">

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_margin="15dp">

            <TextView
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:text="Rounded Corners!"
                android:textStyle="bold"
                android:textColor="#707070"

                />

        </LinearLayout>


    </LinearLayout>
</LinearLayout>

myshape.xml :-


<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
   
    <corners android:radius="10dp" />
    <solid android:color="#CCFFFFFF"/>

</shape>



No comments:

Post a Comment