Page curl effect in Android

Posted by devappandroid March - 6 - 2012 - Tuesday

Below code shows how to implement Page Curl effect in android apps.

Below are the List of java and xml File.

xml File

1. main.xml

Java File

1. EffectingActivity.java

2. PageCurlEffect.java

Below are the code for java and xml file.

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” >

    <com.devappandroid.pagecurl.PageCurlEffect
        android:id=”@+id/dcgpagecurlPageCurlView1″
        android:layout_width=”fill_parent”
        android:layout_height=”fill_parent”
        android:background=”@drawable/page1″ >
    </com.devappandroid.pagecurl.PageCurlEffect>

</LinearLayout>

EffectingActivity.java

package com.devappandroid.pagecurl;

import android.app.Activity;
import android.content.pm.ActivityInfo;
import android.os.Bundle;

public class EffectingActivity extends Activity {

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.setContentView(R.layout.main);
}

@Override
public void onDestroy() {
super.onDestroy();
System.gc();
finish();
}

public void lockOrientationLandscape() {
lockOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
}

public void lockOrientationPortrait() {
lockOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}

public void lockOrientation(int orientation) {
setRequestedOrientation(orientation);
}
}


Download Full Source Code

Please Login Or Register to Download Source Code

Post to Twitter

Leave a Reply