Windows 当从Android Studio运行我的应用程序时,我可以强制将模拟器置于顶部吗?
这是一个相当小的不便,但我希望当我开始从Android Studio运行我的应用程序时,Android Emulator会出现在最前面Windows 当从Android Studio运行我的应用程序时,我可以强制将模拟器置于顶部吗?,windows,android-studio,android-emulator,Windows,Android Studio,Android Emulator,这是一个相当小的不便,但我希望当我开始从Android Studio运行我的应用程序时,Android Emulator会出现在最前面 我知道emulator中的“始终在顶部”设置,但在编写代码时,我必须最小化emulator。运行我的应用程序不会还原模拟器。我已经尝试了一段时间了。。。我想这是办不到的 我通过购买另一台显示器并将模拟器推到另一台显示器上解决了这个问题。为我的问题创建了一个解决方案-我正在Windows 10上开发。 创建PowerShell批处理文件BringProcessTo
我知道emulator中的“始终在顶部”设置,但在编写代码时,我必须最小化emulator。运行我的应用程序不会还原模拟器。我已经尝试了一段时间了。。。我想这是办不到的
我通过购买另一台显示器并将模拟器推到另一台显示器上解决了这个问题。为我的问题创建了一个解决方案-我正在Windows 10上开发。
powershell -command C:\users\username\BringProcessToFront.ps1
下面的@Ves accepted answer确实有效,但更改了批处理文件,因为它不适合我,下面是我如何根据另一个答案编辑批处理文件BringProcessToFront.ps1 然后,我按照已接受答案中的其余步骤进行操作,结果成功了。我使用了一个非常简单的脚本:
#IfWinActive, ahk_class SunAwtFrame
$+F10::
Send, +{F10}
WinActivate, Android Emulator
return
这将运行应用程序,并在您按F10时激活上次使用的仿真器
您也可以编译此文件并让其在未安装AutoHotkey的情况下运行。请参阅我的答案-了解如何在windows上执行此操作。必须能够在所有平台上执行类似操作。
Run>Edit Configuraions
Expand Android App and select app
Before launch: (Hit the green + sign to add a new external tool)
In the "External Tools Dialog" hit the green + to create a new tool)
Name: BringEmulatorToFront
Description: Launch PowerShell to make sure Emulator is visible
Program: powershell
Arguments: -command C:\users\username\BringProcessToFront.ps1
Working directory: C:\users\username
*IMPORTANT*
Uncheck the Advanced options Synchronize files and Open console
(If you leave Open console checked your run will not terminate cleanly)
if ( $args ){
$processName = $args[0]
}
else{
$processName = "qemu-system-i386"
}
Add-Type @"
using System;
using System.Runtime.InteropServices;
public class Tricks {
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool SetForegroundWindow(IntPtr hWnd);
}
"@
sleep -sec 1
$h = (Get-Process $processName).MainWindowHandle
[void] [Tricks]::SetForegroundWindow($h)
#IfWinActive, ahk_class SunAwtFrame
$+F10::
Send, +{F10}
WinActivate, Android Emulator
return