android - How do I change the position of my new Activity (Display Metrics) -


edit: application's interface

i've created pop-up window , class when click oninfowindowclick in google maps, pop-up window appear or next activity appear. used display metrics shows in center screen.

what want happen is: when activity shows up, show in upper-top or @ least have power change position of activity in part of window.

my problem: display metrics shows activity in center.

my codes in pop-up window:

public class popup extends appcompatactivity {     @override     protected void oncreate(@nullable bundle savedinstancestate) {         super.oncreate(savedinstancestate);          setcontentview(r.layout.pop_layout);          displaymetrics dm = new displaymetrics();         getwindowmanager().getdefaultdisplay().getmetrics(dm);          int width = dm.widthpixels;         int height = dm.heightpixels;          getwindow().setlayout((int)(width*.8),(int)(height*.5));      } } 

note: there method this? can give me link on how it. (only if there method it)

just add line @ end:

getwindow().setgravity(gravity.top); 

p.s. can use other values (not gravity.top) according needs. can combine multiple options, instance, getwindow().setgravity(gravity.top|gravity.start);


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -