So you change the Window instead of change the position of Dialog ?
On 9月27日, 下午4時51分, mani <smanikanda...@gmail.com> wrote: > I found a solution to move the dialog position around. > > But the values of x & y are not clear. > > public void onCreate(Bundle savedInstanceState) { > super.onCreate(savedInstanceState); > setContentView(R.layout.main); > > WindowManager.LayoutParams params = > getWindow().getAttributes(); > params.x = 0; > params.height = 100; > params.width = 250; > params.y = -250; > this.getWindow().setAttributes(params); > > } > > If x=0,y=0 it means exactly in the center of the screen. > > with that as the center, the dialog will be scaled or drawn to its > width & height...!! > > Hope this might help others...!! > > Thanks, > Mani > > On Sep 27, 2:56 pm, mani <smanikanda...@gmail.com> wrote: > > > > > > > > > Hi all, > > > I wanted my activity to be displayed as dialog, so i changed my > > manifest.xml to have > > android:theme="@android:style/Theme.Dialog" > > > Then i wanted it be at position (50,50 ) . I could able to set width & > > height but not (x,y). I went through one more post, > > >http://www.mail-archive.com/android-developers@googlegroups.com/msg32... > > > it says how to set the x,y by setting to window layout params of the > > dialog. > > > I tried like below. > > > this.getWindow().setLayout(200,200); > > > There are no apis for Window to set x,y. Can anyone pls help here ? > > How to position the dialog ( activity ). > > > I also tried to set the parameter android:layout_x & android:layout_y > > for activity & application both, nothing worked out.!! > > > <?xml version="1.0" encoding="utf-8"?> > > <manifest xmlns:android="http://schemas.android.com/apk/res/android" > > package="com.android.helloworld" > > android:versionCode="1" > > android:versionName="1.0"> > > <application android:icon="@drawable/icon" android:label="@string/ > > app_name" > > android:windowSoftInputMode="stateAlwaysVisible" > > android:debuggable="true" > > android:layout_x="135px" android:layout_y="100px" > > > <activity android:name=".helloworld" > > android:label="@string/app_name" > > android:theme="@android:style/Theme.Dialog" > > android:layout_x="135px" android:layout_y="360px" > > > <intent-filter> > > <action android:name="android.intent.action.MAIN" /> > > <category > > android:name="android.intent.category.LAUNCHER" /> > > </intent-filter> > > </activity> > > > </application> > > <uses-permission android:name="android.permission.INTERNET"/> > > > </manifest> > > > - mani -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en