窗体的大小和位置通过WindowManager.LayoutParams来设置,在通过x和y值来设置窗体位置时,需要注意gravity属性,如果gravity没有设置或者是center之类的,那么设置的x和y值就不会起作用,具体的说明见
X position for this window. With the default gravity it is ignored. When using LEFT or START or RIGHT or END it provides an offset from the given edge.
Y position for this window. With the default gravity it is ignored. When using TOP or BOTTOM it provides an offset from the given edge.