Aug 1, 2011

Remove Title Bar To Custom Dialog and Place a dialog and without fading the background



for removing title bar to Custom Dialog :
-----------------------------------------------

// Allocating Memory to dialog object

 Dialog dialog=new Dialog(this);
// for removing title Bar
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
// Later set Layout to dialog
dialog.setContentView(R.layout.authdialog);




Show  Android Dialog without fading the back Ground :
-----------------------------------------------------------------


dialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);


or 




<?xml version="1.0" encoding="utf-8"?>
<resources>
  <style name="Theme.DoNotDim" parent="android:Theme">
    <item name="android:backgroundDimEnabled">false</item>
  </style>
</resources>
And apply the theme to your activity.
<activity android:name=".SampleActivity" android:theme="@style/Theme.DoNotDim">

Dialog Position :
================
ProgressDialog dialog = ProgressDialog.show(AContext, "Test", "On the bottom");
dialog.getWindow().setGravity(Gravity.BOTTOM);

No comments:

Post a Comment