Header Ads

Android Button এর বিভিন্ন Design.

Android এ আমরা যে Text View গুলো ব্যবহার করি সেগুলোর বিভিন্ন Design রয়েছে। আজকে দেখাব Text View এর বিভিন্ন Design সমূহ। নিচের ছবিতে দেখুন।





এখানে দেখুন আমি কয়েকটা Button Design করেছি। নিচে Coding গুলো দেখুন ।

activity_main.xml:


<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

    xmlns:app="http://schemas.android.com/apk/res-auto"

    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#000fff"
    android:orientation="vertical"
    tools:context=".MainActivity">

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical" >

            <Button
                android:id="@+id/button3"
                android:layout_width="200dp"
                android:layout_height="200dp"
                android:layout_marginTop="20dp"
                android:gravity="center"
                android:layout_gravity="center"
                android:background="@drawable/button_bg_round"
                android:textColor="#000000"
                android:textSize="40dp"
                android:text="Button" />

            <Button
                android:id="@+id/button5"
                android:layout_width="234dp"
                android:layout_height="250dp"
                android:layout_gravity="right"
                android:layout_marginTop="20dp"
                android:background="@drawable/bn_bg_tringle"
                android:gravity="left|center"
                android:text="FAC"
                android:textColor="#ffffff"
                android:textSize="40dp" />

            <Button
                android:id="@+id/button6"
                android:layout_width="200dp"
                android:layout_height="200dp"
                android:layout_marginTop="20dp"
                android:gravity="center"
                android:layout_gravity="center"
                android:background="@drawable/bn_round"
                android:textColor="#ffffff"
                android:textSize="40dp"
                android:text="Button" />

        </LinearLayout>
    </ScrollView>
</LinearLayout>

drawable:





bn_bg :

<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >

<solid android:color="#D2B48C" />
<stroke android:width="5dp" android:color="#BDB76B"/>
<corners android:radius="10dp"/>
<gradient
    android:startColor="#8B4513"
    android:centerColor="#CD853F"
    android:endColor="#A0522D"
    android:centerX="0.5"
    android:centerY="0.5"
    android:gradientRadius="100"
    android:type="linear" />
</shape>

bn_bg_fac :

<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >

<solid android:color="#FFD700" />
<stroke android:width="5dp" android:color="#00BFFF"/>
<corners android:radius="10dp"/>
<gradient
    android:startColor="#1E90FF"
    android:centerColor="#20B2AA"
    android:endColor="#0000CD"
    android:centerX="0.5"
    android:centerY="0.5"
    android:gradientRadius="100"
    android:type="linear" />
</shape>

bn_bg_facf :

<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >

<solid android:color="#ff0080" />
<stroke android:width="5dp" android:color="#000ee0"/>
<corners android:radius="50dp"/>
<gradient
    android:startColor="#6660FF"
    android:centerColor="#70ffff"
    android:endColor="#ff00CD"
    android:centerX="0.5"
    android:centerY="0.5"
    android:gradientRadius="100"
    android:type="linear" />
</shape>

bn_bg_round:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:padding="10dp"
    android:shape="rectangle" >

    <solid android:color="#FFFFFF" /> //This should be the yellow color you want

    <corners android:radius="5dp" /> //for rounded corners

    <stroke
        android:width="2dp"
        android:color="#0000CD" /> //for border if you wish any

</shape>

bn_bg_tringle:

<?xml version="1.0" encoding="utf-8"?>

<rotate android:fromDegrees="45"
    android:pivotX="10%"
    android:pivotY="-30%"
    android:toDegrees="-45"
    xmlns:android="http://schemas.android.com/apk/res/android">
        <shape android:shape="rectangle" >
            <stroke
                android:width="1dp"
                android:color="@android:color/transparent" />

            <solid android:color="#00C6FF" />
        </shape>
    </rotate>



bn_round:

<shape xmlns:android="http://schemas.android.com/apk/res/android">
 <solid android:color="#f00" />
 <corners
    android:topLeftRadius="30dp"
   android:topRightRadius="30dp"
     android:bottomLeftRadius="30dp"
     android:bottomRightRadius="30dp"
     />
 <size 
  android:height="25dp"
   android:width="25dp"/>
</shape>

bn_shape:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">

    <gradient
        android:endColor="#4B0082"
        android:gradientRadius="80dp"
        android:type="radial"
        android:startColor="#FF5733" />

    <corners android:radius="@android:dimen/app_icon_size" />

    <stroke
        android:width="4dp"
        android:color="@android:color/black" />

</shape>

btn_design:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:state_pressed="true">
        <shape android:shape="rectangle">

            <solid android:color="#FF5733" />
            <corners android:radius="10dp" />

        </shape>

    </item>
    <item>
        <shape android:shape="rectangle">
            <solid android:color="#BC8F8F" />
            <corners android:radius="10dp" />
        </shape>

    </item>

</selector>


btn_round:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle" >

    <corners
        android:bottomLeftRadius="50dp"
        android:bottomRightRadius="50dp"
        android:radius="60dp"
        android:topLeftRadius="50dp"
        android:topRightRadius="50dp" />

    <solid android:color="#CFCFCF" />

    <padding
        android:bottom="0dp"
        android:left="0dp"
        android:right="0dp"
        android:top="0dp" />

    <size
        android:height="60dp"
        android:width="270dp" />

</shape>

btn_shape_round:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:padding="16dp"
    android:shape="rectangle">
    <stroke
        android:width="1dp"
        android:color="@android:color/black" />
    <corners android:radius="10dp" />
</shape>

button_background:

<?xml version="1.0" encoding="UTF-8"?>

          <shape xmlns:android="http://schemas.android.com/apk/res/android"

             android:shape="rectangle" android:padding="40dp">

          <!-- you can use any color you want I used here gray color-->

         <solid android:color="#01A9DB"/>

          <corners

          android:bottomRightRadius="20dp"

          android:bottomLeftRadius="20dp"

          android:topLeftRadius="20dp"

          android:topRightRadius="20dp"/>

      </shape>

button_background_fac:

<?xml version="1.0" encoding="UTF-8"?>

<shape xmlns:android="http://schemas.android.com/apk/res/android"

    android:shape="rectangle" android:padding="40dp">

    <!-- you can use any color you want I used here gray color-->

    <stroke android:color="#00FFFF" android:width="5dp" />
    <solid android:color="#FFE4C4"/>

    <corners

        android:bottomRightRadius="30dp"

        android:bottomLeftRadius="30dp"

        android:topLeftRadius="30dp"

        android:topRightRadius="30dp"/>

</shape>

button_bg_round:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape android:shape="oval">
            <stroke android:color="#1E90FF" android:width="5dp" />
            <solid android:color="#87CEEB"/>
            <size android:width="150dp" android:height="150dp"/>
        </shape>
    </item>
</selector>

button_design:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">


        <item android:state_pressed="true">

            <shape android:shape="oval">
                <gradient android:angle="135" android:endColor="@color/jd_red" android:startColor="@color/green" />
                <corners android:radius="20dp" />
                <stroke android:width="2dp" android:color="@android:color/black" />
            </shape>

        </item>

        <item>
            <shape android:shape="rectangle">
                <gradient android:angle="225" android:endColor="@color/green" android:startColor="@color/jd_red" />
                <corners android:radius="@android:dimen/app_icon_size" />
                <stroke android:width="4dp" android:color="@android:color/black" />
            </shape>

        </item>

</selector>

button_dialog:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
    <corners
        android:radius="14dp"
        />
    <gradient
        android:angle="90"
        android:centerX="35%"
        android:centerColor="#F0E68C"
        android:startColor="#FFA07A"
        android:endColor="#FFE4B5"
        android:type="linear"
        />
    <padding
        android:left="0dp"
        android:top="0dp"
        android:right="0dp"
        android:bottom="0dp"
        />
    <size
        android:width="270dp"
        android:height="60dp"
        />
    <stroke
        android:width="3dp"
        android:color="#FFFFE0"
        />
</shape>

button_main:

<?xml version="1.0" encoding="UTF-8"?>

<shape xmlns:android="http://schemas.android.com/apk/res/android"

    android:shape="rectangle" android:padding="40dp">

    <!-- you can use any color you want I used here gray color-->

    <stroke android:color="#8B4513" android:width="5dp" />
    <solid android:color="#A0522D"/>

    <corners

        android:bottomRightRadius="30dp"

        android:bottomLeftRadius="30dp"

        android:topLeftRadius="30dp"

        android:topRightRadius="30dp"/>

</shape>

button_shap:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">

    <gradient
        android:endColor="@color/blue"
        android:gradientRadius="30dp"
        android:type="radial"
        android:startColor="@color/yellow" />

    <corners android:radius="@android:dimen/app_icon_size" />

    <stroke
        android:width="4dp"
        android:color="#00FFFF" />

</shape>

button_shape:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">

    <gradient
        android:endColor="#FF5733"
        android:gradientRadius="60dp"
        android:type="radial"
        android:startColor="@color/yellow" />

    <corners android:radius="@android:dimen/app_icon_size" />

    <stroke
        android:width="4dp"
        android:color="@android:color/black" />

</shape>

button_start:

<?xml version="1.0" encoding="UTF-8"?>

<shape xmlns:android="http://schemas.android.com/apk/res/android"

    android:shape="rectangle" android:padding="40dp">

    <stroke android:color="#F4A460" android:width="5dp" />
    <solid android:color="#D2B48C"/>

    <corners

        android:bottomRightRadius="30dp"

        android:bottomLeftRadius="30dp"

        android:topLeftRadius="30dp"

        android:topRightRadius="30dp"/>

</shape>

circle:

<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:innerRadius="0dp"
    android:shape="ring"
    android:thicknessRatio="1.9"
    android:useLevel="false" >
    <solid android:color="@android:color/transparent" />

    <stroke
        android:width="10dp"
         />
</shape>




Ok বন্ধুরা Button এর যে Design গুলো আমার মনে আছে তার সব Design আমি এখানে দিয়ে দিয়েছি। আপনারা Design গুলো Apply করার চেষ্টা করুন। আসা করি উপকৃ্ত হবেন। কিছু না বুঝলে Commend করবেন। Thank You
আমার সব Blog পেতে Click করুন



No comments

Powered by Blogger.