ANDROID FOR FRESHERS
Android Program of Drawable shape resource
Java Code(ShapeAct)
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
public class ShapeAct extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_shape);
}
}
Layout XML Code(activity_shape)
<?xml version=”1.0″ encoding=”utf-8″?>
<ScrollView android:layout_height=”match_parent”
android:layout_width=”match_parent”
xmlns:android=”http://schemas.android.com/apk/res/android” >
<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:paddingBottom=”@dimen/activity_vertical_margin”
android:orientation=”vertical”
android:paddingLeft=”@dimen/activity_horizontal_margin”
android:paddingRight=”@dimen/activity_horizontal_margin”
android:paddingTop=”@dimen/activity_vertical_margin”
tools:context=”com.andro.tech.androidproject.ShapeAct”>
<TextView
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:textSize=”@dimen/textsize”
android:layout_gravity=”center”
android:textStyle=”bold”
android:text=”DRAWABLE RESOURCES”
android:layout_marginBottom=”30dp” />
<TextView
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:textColor=”@color/bgcolor”
android:textSize=”15sp”
android:text=”DIFFERENT SHAPES OF BUTTON”
android:layout_marginBottom=”30dp” />
<Button
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:text=”BUTTON”
android:background=”@color/four”
android:textStyle=”bold”
android:layout_gravity=”center”
android:textColor=”@color/text”
android:layout_marginBottom=”20dp”/>
<Button
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:text=”BUTTON1″
android:layout_gravity=”center”
android:background=”@drawable/shape”
android:textStyle=”bold”
android:textColor=”@color/text”
android:layout_marginBottom=”20dp”/>
<Button
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:text=”BUTTON2″
android:layout_gravity=”center”
android:background=”@drawable/shape1″
android:textStyle=”bold”
android:textColor=”@color/text”
android:layout_marginBottom=”20dp”/>
<Button
android:layout_width=”100dp”
android:layout_height=”100dp”
android:text=”B”
android:textSize=”30sp”
android:background=”@drawable/shape2″
android:textStyle=”bold”
android:layout_gravity=”center”
android:layout_marginBottom=”20dp”/>
<Button
android:layout_width=”match_parent”
android:layout_height=”wrap_content”
android:text=”@string/sourcecode”
android:background=”@color/bgcolor”
android:textStyle=”bold”
android:textColor=”@color/text”
android:onClick=”view1″/>
</LinearLayout>
</ScrollView>
XML Code(shape)
<?xml version=”1.0″ encoding=”utf-8″?>
<shape xmlns:android=”http://schemas.android.com/apk/res/android”>
<solid android:color=”@color/c_one”/>
<size android:height=”50dp” android:width=”150dp”/>
<corners android:radius=”30dp”/>
<stroke android:width=”2dp” android:color=”#ff0000″/>
<gradient
android:startColor=”#000″
android:centerColor=”@color/c_one”
android:endColor=”#000″ />
</shape>
XML Code(shape1)
<?xml version=”1.0″ encoding=”utf-8″?>
<shape xmlns:android=”http://schemas.android.com/apk/res/android”
android:shape=”oval”>
<solid android:color=”@color/c_one”/>
<size android:height=”50dp” android:width=”150dp”/>
<corners android:radius=”30dp”/>
<stroke android:width=”2dp” android:color=”#ff0000″/>
</shape>
XML Code(shape2)
<?xml version=”1.0″ encoding=”utf-8″?>
<shape xmlns:android=”http://schemas.android.com/apk/res/android”
android:shape=”ring”
android:innerRadius=”30dp”
android:thickness=”10dp”
android:useLevel=”false”>
<solid android:color=”@color/c_one”/>
<size android:height=”50dp” android:width=”150dp”/>
</shape>
Output
Download Android Drawable Resource Source Code
For More Android Programs –Click Here
Follow Us – Never Miss Update
Fb/Page, Twitter, Google+, Instagram, Pinterest
Related Search
Android Drawable shape resource code download, Drawable shape resource code download, Different android button code. xml button code in android, android buttons shape code, different button shapes in android, code for buttons shapes, android code for buttons shape, design android button shape download code, resource xml shape button in android, android button resources code download