我创建了一个带有按钮的 Main.xml。它们都执行特定的操作,这一切都很好,但还应该有密码保护的按钮。所以我还创建了第二个 xml (popup.xml)。如果用户按下按钮,应该会弹出该信息。在 popup.xml 中,只有一个用于用户输入的文本字段和一个用于提交的按钮。
目前我可以按下按钮并出现弹出窗口,但我不知道如何将用户输入数据提交到主视图或仅通过按下按钮返回主视图。
public class BastiLauncherActivity extends Activity implements OnClickListener {
private Button b1;
// ...
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// this b1 is a button in the main view where this pop up should appear
b1 = (Button) findViewById(R.id.b1Button);
b1.setOnClickListener(this);
// ...
}
@Override
public void onClick(View v) {
LayoutInflater inflater =
(LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
PopupWindow pw = new PopupWindow(inflater.inflate(R.layout.popup, null,
false), 200, 300, true);
pw.setOutsideTouchable(true);
if (v == b1) {
// …
Run Code Online (Sandbox Code Playgroud) 我有一个“主要”表格(form1
)。在那个表单中,我成功地打开了另一个表单 ( form2
) - 但是 - 当该表单打开时,您仍然可以控制底层表单 ( form1
)。
我不希望用户能够这样做,每当他试图点击它或其他东西时,弹出的表单 ( form2
) 应该获得焦点/闪烁,并带有一些默认的 Windows 声音。我刚刚描述了如果弹出窗口是 FileSave/OpenDialog 时它的行为。这些对话框完全按照我希望的方式工作。
我试过设置,form2.Owner = form1;
但没有达到预期的效果。
所以我的问题基本上是:我怎样才能获得相同的焦点/等效果。在表单上 - 它在 Save/OpenDialog 上如何?
谢谢,
~ Tgys
如何在mac上制作一个简单的弹出气球消息。我不想使用 NSUserNotification。使用 python-2.7 和 osx 10.8.5。POP-UP 不应该有任何按钮。弹出窗口应该来,显示消息并自动去。它也应该与 py2app 正确打包。
import objc
import Foundation
import AppKit
def notify(title, subtitle, info_text, delay=0, sound=False, userInfo={}):
NSUserNotification = objc.lookUpClass('NSUserNotification')
NSUserNotificationCenter = objc.lookUpClass('NSUserNotificationCenter')
notification = NSUserNotification.alloc().init()
notification.setTitle_(title)
notification.setSubtitle_(subtitle)
notification.setInformativeText_(info_text)
notification.setUserInfo_(userInfo)
if sound:
notification.setSoundName_("NSUserNotificationDefaultSoundName")
notification.setDeliveryDate_(Foundation.NSDate.dateWithTimeInterval_sinceDate_(delay, Foundation.NSDate.date()))
NSUserNotificationCenter.defaultUserNotificationCenter().scheduleNotification_(notification)
def notificationBalloon(title,msg):
notify(title1, msg1,"", sound=False)
Run Code Online (Sandbox Code Playgroud) 我需要在活动开始后立即显示一个弹出窗口,但是我最终导致应用程序崩溃,我当前的代码是:
public class GameActivity extends SherlockActivity {
Button firstAnswer;
...
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_game);
...
firstAnswer = (Button) findViewById(R.id.firstanswerbtn);
...
}
protected void onStart() {
super.onStart();
LayoutInflater layoutInflater = (LayoutInflater) getBaseContext()
.getSystemService(LAYOUT_INFLATER_SERVICE);
View popupView = layoutInflater.inflate(R.layout.playpopup, null);
final PopupWindow popupWindow = new PopupWindow(popupView, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
Button play = (Button) popupView.findViewById(R.id.letsplay);
play.setOnClickListener(new Button.OnClickListener() {
@Override
public void onClick(View v) {
playRound();
popupWindow.dismiss();
}
});
popupWindow.showAtLocation(firstAnswer, Gravity.CENTER, 0, 0);
}
...
}
Run Code Online (Sandbox Code Playgroud)
但是我最终崩溃了:
12-02 22:27:27.534: E/AndroidRuntime(28142): java.lang.RuntimeException: Unable to …
Run Code Online (Sandbox Code Playgroud) 我正在尝试创建一个具有以下规格的 Chrome 扩展:
在我当前的实现中,我没有在manifest.json 中设置默认弹出窗口。如果后台脚本发现存在访问令牌,它将使用 chrome.browserAction.setPopup 设置弹出窗口。但是,只有在我单击该图标两次后才会显示弹出窗口。我知道这是因为它在第一次单击时设置弹出窗口,然后在第二次单击时显示它。但是,有什么办法让它显示在第一个吗?
有没有更好的方法来实现这个逻辑,这样我就不必在每次检测到访问令牌时都设置弹出窗口并要求用户单击两次(在我看来,这对用户来说不是很友好)?
谢谢!
如何在 Android 上创建可滚动弹出窗口?这是我的带有弹出窗口的代码,请有人帮助我使用可滚动弹出窗口。
请帮助我使用可滚动窗口。
我需要询问 [System.Windows.MessageBox] 的超时问题,代码如下:
\n\n“logX”(如log1、log2或log3)是写入文件的函数,仅更改Log3。Log3 写入后执行“退出”(离开脚本)。我们不需要这个函数如何工作
\n\n#Funcion para comprobar si existe el token o no.\nfunction Token{\n#comprobamos si existe el fichero\n$token = Test-Path $dir_token\nif($token -eq $True){\n #Existe el fichero\n $ftoken = 1\n}else{ \n #No existe el fichero\n $ftoken = 0\n}\nreturn $ftoken\n}\n\n#Asignamos direcci\xc3\xb3n de token\n$Global:dir_token = "D:\\Nuevacarpeta\\Nueva carpeta\\token.txt"\n#Ejecutamos la funcion de Token para saber si existe ahora mismo\n$ftoken = Token\n#Preparamos la ruta del log\n$log = "D:\\Nuevacarpeta\\log\\log.txt"\n\n#Creamos la variable Outlook transformandolo en un objeto (Commobject de Powershell)\n$Global:outlook = New-Object -comobject outlook.application\n$comprobaroutlook = …
Run Code Online (Sandbox Code Playgroud) 如何动态设置 no ofPopupMenuItem
到PopupMenuButton
with 索引,如ListView.builder()
.
实际上,我用来FutureBuilder
从 api 获取数据,作为响应,获取了 4 个项目,这意味着它提供了动态的项目数。并想以PopupMenuItem
列表形式显示它们。PopupMenuButton
但Like中没有 count 构造函数ListView.builder()
。
代码:
FutureBuilder<CommonModel>(
future: futureListMaterialStatusCommonModel,
builder:(BuildContext context, AsyncSnapshot<CommonModel> snapshot ){
if(!snapshot.hasData){
return Text("loading...");
}
if(snapshot.hasError){
return Text(snapshot.error);
}
//I tried to get solution by loop before showing items but went wrong
for(int i ; i< snapshot.data.content.length; i++){
itemList.add(
PopupMenuItem(
value: snapshot.data.content[i].title,//919876543210,
child: Text(
snapshot.data.content[0].title,
style: TextStyle(
color: Colors.black, fontWeight: FontWeight.w700),
),
),
);
}
return PopupMenuButton<String>( …
Run Code Online (Sandbox Code Playgroud) 我正在尝试创建一个类似于此的弹出框:单击此处
我只想使用JavaScript.我意识到我可能通过提出这个要求更难以完成这项任务,但我仍然在努力学习JavaScript,所以我真的不想把自己与JQuery混淆.我基本上想要制作提示或警报样式弹出框.在此先感谢您的帮助!
寻找小而轻的弹出气球JS库.(不是其他lib的一部分,如jquery)
必须跨浏览器.
我发现了几个.有推荐吗?
下一页有什么问题?
<html>
<head>
<script type="text/javascript">
function openWin(url, w, h)
{
var left = (screen.width/2)-(w/2);
var top = (screen.height/2)-(h/2);
w=window.open(url, '_blank', 'width='+w+', height='+h+', scrollbars=no, menubar=no, resizable=no, location=no, toolbar=no, top='+top+', left='+left+', 'false');
w.focus();
}
</script>
</head>
<body>
<input type="button" value="Open window" onclick="openWin(about:blank, 200, 200)" />
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
每当我单击按钮时,都不会发生任何事情。
使用铬
我需要用纯JS编写脚本,以便在加载页面时显示弹出窗口。
背景需要褪色,我必须将自己的内容添加到弹出窗口中。我不想使用CSS或HTML。
将CSS和HTML放入Javascript代码中。有人可以帮我弄这个吗?
我可以自己做样式。
我只能使用外部CSS和HTML弹出窗口,而不能使用纯JS弹出窗口。它只必须是用纯JS编写的简单弹出窗口,它在加载页面时就会弹出。
请帮我!!
我更喜欢使用JSFiddle。
我正在编写一个注册屏幕,当登录信息不正确时会弹出错误提示.