I would like to place the dialog on a particular position on the screen(-10px from top and -5px from let).
I did apply the theme and added the android:scrollX<
This is the code!
LayoutParams lp = this.getWindow().getAttributes();
lp.x=50;lp.y=20;lp.width=100;lp.height=200;lp.gravity=Gravity.TOP | Gravity.LEFT;
lp.dimAmount=0;
lp.flags=LayoutParams.FLAG_LAYOUT_NO_LIMITS | LayoutParams.FLAG_NOT_TOUCH_MODAL;
this.setContentView(view, lp);
Don't extend the dialog theme extend the panel theme.
<style name="Theme.CustomPanel" parent="@android:style/Theme.Panel">
<item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item>
<item name="android:backgroundDimEnabled">true</item>
</style>
This creates a window similar to a dialog except it doesn't center it like a dialog does. Then create an activity like you normally would then start it.
To make it 5px from left and 10px from top just put padding on your layout
<!-- res/layout/your_layout.xml -->
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingTop="10px"
android:paddingLeft="5px"></FrameLayout>
And of course your activity should just be normal like
public class NonCenteredDialogActivity extends Activity{
protected void onCreate(Bundle bundle){
super.onCreate(bundle);
setContentView(R.layout.your_layout);
}
}