Showing posts with label xml. Show all posts
Showing posts with label xml. Show all posts

Thursday, 25 December 2014

Color shade effects designing in android

Today i am going to post about color shade designing in android with using XML.

You can download necessary files for this example from HEAR.


In this there is no need to Add anything in java file, you can design by XML file only.

activity_main.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context="com.AndroidTecHub.colorshade.MainActivity" >
   
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:orientation="horizontal"
        android:layout_weight="5"
        android:weightSum="9">
       
        <FrameLayout
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="3"
            android:background="@drawable/one_shade">
           
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="1"
                android:textSize="55dp"
                android:layout_gravity="center"/>
           
        </FrameLayout>
        <FrameLayout
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="3"
            android:background="@drawable/two_shade">
           
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="2"
                android:textSize="55dp"
                android:layout_gravity="center"/>
           
        </FrameLayout>
        <FrameLayout
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="3"
            android:background="@drawable/three_shade">
           
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="3"
                android:textSize="55dp"
                android:layout_gravity="center"/>
           
        </FrameLayout>
       
    </LinearLayout>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:orientation="horizontal"
        android:layout_weight="5">
       
        <FrameLayout
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="3"
            android:background="@drawable/four_shade">
           
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="4"
                android:textSize="55dp"
                android:layout_gravity="center"/>
           
        </FrameLayout>
        <FrameLayout
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="3"
            android:background="@drawable/five_shade">
           
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="5"
                android:textSize="55dp"
                android:layout_gravity="center"/>
           
        </FrameLayout>
        <FrameLayout
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="3"
            android:background="@drawable/six_shade">
           
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="6"
                android:textSize="55dp"
                android:layout_gravity="center"/>
           
        </FrameLayout>
       
    </LinearLayout>




</LinearLayout>




Hear is one of the drawable xml file for example,You can download all file from download link.

one_shad.xml

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item >
    <shape android:shape="rectangle"  >
         <gradient android:angle="-90" android:startColor="#FF0000" android:endColor="#FFFFFF" />           
     </shape>
 </item>
</selector>



You can download necessary files for this example from HEAR.

I hope it will help you in developing android app.
Happy coding...