1)First you have to create a method that display an pop-up.
public void display_popup() {
LayoutInflater layoutInflater = (LayoutInflater) getBaseContext()
.getSystemService(LAYOUT_INFLATER_SERVICE);
View popupView= layoutInflater.inflate(R.layout.follow_leader, null);
PopupWindow popupWindow = new PopupWindow(popupView, LayoutParams.FILL_PARENT,
LayoutParams.FILL_PARENT);
popupWindow.showAtLocation(popupView, Gravity.CENTER, 0, 0);
}
2)Next you have to write an animation XML for your pop-up inside res/anim folder.
fade_in.xml
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:fillAfter="true">
<alpha android:fromAlpha="0.0"
android:toAlpha="1.0"
android:duration="3000"/> //Time in milliseconds
</set>
fade_out.xml
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:fillAfter="true" >
<alpha android:duration="3000"
android:fromAlpha="1.0"
android:toAlpha="0.0" />
</set>
3)After that you have to write an style for your pop-up inside values/style.xml file.
<style name="PopupWindowAnimation">
<item name="android:windowEnterAnimation">@anim/fade_in</item>
<item name="android:windowExitAnimation">@anim/fade_out</item>
</style>
4)Finally you set this style to pop-up by writing the below in your display_popup() method.
popupWindow.setAnimationStyle(R.style.PopupWindowAnimation);
Done..android rocks..
public void display_popup() {
LayoutInflater layoutInflater = (LayoutInflater) getBaseContext()
.getSystemService(LAYOUT_INFLATER_SERVICE);
View popupView= layoutInflater.inflate(R.layout.follow_leader, null);
PopupWindow popupWindow = new PopupWindow(popupView, LayoutParams.FILL_PARENT,
LayoutParams.FILL_PARENT);
popupWindow.showAtLocation(popupView, Gravity.CENTER, 0, 0);
}
2)Next you have to write an animation XML for your pop-up inside res/anim folder.
fade_in.xml
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:fillAfter="true">
<alpha android:fromAlpha="0.0"
android:toAlpha="1.0"
android:duration="3000"/> //Time in milliseconds
</set>
fade_out.xml
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:fillAfter="true" >
<alpha android:duration="3000"
android:fromAlpha="1.0"
android:toAlpha="0.0" />
</set>
3)After that you have to write an style for your pop-up inside values/style.xml file.
<style name="PopupWindowAnimation">
<item name="android:windowEnterAnimation">@anim/fade_in</item>
<item name="android:windowExitAnimation">@anim/fade_out</item>
</style>
4)Finally you set this style to pop-up by writing the below in your display_popup() method.
popupWindow.setAnimationStyle(R.style.PopupWindowAnimation);
Done..android rocks..


