当前位置的Acitvity施加一个主题对话在特定的X,Y位置当前位置、位置、主题、在特定

2023-09-07 09:25:03 作者:哥的世界你不懂

我想将对话框上的特定位置在屏幕上(-10px从顶部和让-5px)。

I would like to place the dialog on a particular position on the screen(-10px from top and -5px from let).

我做应用的主题,并添加了安卓scrollX 安卓scrollY ,但它不似乎工作。

I did apply the theme and added the android:scrollX, android:scrollY, but it doesn't seem to work.

任何solutuions?

Any solutuions?

下面是我的造型XML。

Below is my styling xml.

<style name="Theme.MyDialog1" parent="android:style/Theme.Dialog">
    <item name="android:windowNoTitle">true</item>
    <item name="android:windowBackground">@android:color/transparent</item>
    <item name="android:layout_width">300dp</item>
    <item name="android:scrollX">-10dp</item>
    <item name="android:scrollY">-5dp</item>
</style>

编辑:

我也尝试安卓layout_x 安卓!layout_y ,但没有用

这是一个,我有 ![在此输入图片说明] [1]

This is the one that I have ![enter image description here][1]

但我真正想要的是这仅仅是低于注册标志放置在特定x和y的正!!!!! [在此输入图片说明] [2]

but what I really want is which is just below the signup logo positioned at a particular x and y positive!!!!![enter image description here][2]

推荐答案

这是在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);