Showing posts with label Transparetn background. Show all posts
Showing posts with label Transparetn background. Show all posts

Saturday, May 23, 2015

Transparent app background android example

In this android example we learn, how to set 100% Transparent background to make our app more attractive or give special look.

CREATE NEW ANDROID PROJECT
Step 1:write code into activity_main.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"    <TextViewStep 2:write code into your MainActivity.javapackage com.transparent.background;import android.app.Activity;public class MainActivity extends Activity { @OverrideStep 3: edit your AndroidManifest.xml<?xml version="1.0" encoding="utf-8"?>    <uses-sdk    <application            <!--                <category android:name="android.intent.category.LAUNCHER" />





    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#80000000"
    tools:context=".MainActivity" >

        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:text="http://emprovantiontechsol.blogspot.in/"
        android:textColor="#FFFFFF"
        android:textSize="25sp" />

</RelativeLayout>



import android.os.Bundle;


protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}


<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.transparent.background"
    android:versionCode="1"
    android:versionName="1.0" >

        android:minSdkVersion="19"
        android:targetSdkVersion="23" />

        android:allowBackup="true"
        android:icon="@drawable/ic_luncher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.transparent.background.MainActivity"
            android:label="@string/app_name"
            android:theme="@android:style/Theme.DeviceDefault.Light.NoActionBar.TranslucentDecor" >

            if you want to use android minimum SDK version 8 to pressent then set theme that given below.
            android:theme="@android:style/Theme.Translucent"
            -->
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

            </intent-filter>
        </activity>
    </application>

</manifest>

Step 4: Now run your app:
Output: