如何移动自定义对话框?自定义、对话框

2023-09-07 13:13:38 作者:上帝是个妞灬

我是初学者在机器人。我创建一个自定义对话框,它工作正常。但是这个对话框不会移动。如何将这个自定义对话框。例如,在窗口中含有记事本,画图等,当你点击这个(记事本,画图等),标题栏可以移动的位置。如果可能的话,请发信息如何移动对话框。否则,如果这是不可能的发送理由。请回复您的答案和建议是宝贵的我。谢谢你。

I am beginner in android. I am creating a Custom Dialog box, it is working fine. But this dialog box does not moved. How to move this custom dialog box. For example in windows contains Notepad, Paint, etc. When you click this (Notepad, Paint, etc) title bar you can move the position. If it is possible please send information how to move dialog box. Otherwise if it is not possible send Reason. Please reply your answers and comments are valuable me. Thanks.

推荐答案

对话框没有任何触摸事件侦听器,所以你有可能会创建活动,实施onTouchListener就可以了,并在清单文件

Dialog doesn't have any Touch event listeners so you might possibly create an Activity, implement onTouchListener on it, and in manifest file

<活动机器人:主题=@安卓风格/ Theme.Dialog>

现在你的活动会看起来像一个DialogBox的,并且可以实现视图的 setOnTouchListener()和写入所需的code在监听器。

Now your Activity will look like a DialogBox, and you can implement the view's setOnTouchListener() and write the required code in that listener.