我的Ui文件中有两个按钮
div(style="display:inline-block",submitButton("Analysis")),
div(style="display:inline-block",downloadButton('downloadData', 'Download Data'))
Run Code Online (Sandbox Code Playgroud)
这在应用程序中提供以下输出

但是我正在尝试对齐这些按钮,以便下载数据位于灰色框的右侧,分析按钮位于灰色框的左侧,而不是现在的样子.我该怎么做?预期用途是变得更先进并创建另一个位于灰色框中间的按钮.我假设你做了类似的事情
style="display:center-align"
style="display:right-align"
style="display:left-align"
Run Code Online (Sandbox Code Playgroud)
但我不确定如何进行这个过程.
如果我在Mac OS X上打开一个应用程序,则该应用程序按钮会像球一样弹起,然后向上高2倍,然后再次升高。可以使用弹跳动画或其他某种动画来完成此操作吗?
Button希望从电话中跳出(稍稍增长),然后收缩2倍,然后再重新开始使用大按钮。就像将球从观众的眼睛直接向下投射到显示器一样。
我想引起用户的注意,该按钮正在等待被点击:)
这就是我得到的:
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<scale
android:duration="400"
android:fromXScale="1"
android:fromYScale="1"
android:interpolator="@android:anim/bounce_interpolator"
android:pivotX="50%"
android:pivotY="50%"
android:toXScale="1.1"
android:toYScale="1.1"
android:repeatCount="4" />
Run Code Online (Sandbox Code Playgroud)
然后开始
Animation bounce = AnimationUtils.loadAnimation(5his, R.anim.bounce);
somebutton.startAnimation(bounce);
Run Code Online (Sandbox Code Playgroud)
但是它只是在400秒内增加到110%,然后又从100%重新开始。无弹跳效果。
有任何想法吗?
我正在构建一个包含很多按钮的Windows PC程序,看起来很简单.所以我想知道,当你按下一个按钮(使用tkinter)时,我可以这么做吗,我可以播放一些声音来使程序活跃起来吗?请记住我正在学习所以请把它愚蠢一点.
我的按钮代码如下所示:
<button onclick="submitFunction()">Submit</button>
Run Code Online (Sandbox Code Playgroud)
我的功能代码如下:
function submitFunction() {
alert("example");
}
Run Code Online (Sandbox Code Playgroud)
我一直在网上寻找答案并尝试了很多东西,但似乎没有任何效果.我只是把警报放在那里,看看是否正在调用该函数.我正在使用以下链接文件.
<script src="file.js"></script>
Run Code Online (Sandbox Code Playgroud) 当将Xcode中的按钮连接为@IBAction func时,我们可以在Arguments:Sender或None之间进行选择.
我们什么时候选择Sender?什么时候选择None?
当我单击该按钮时,将打开一个FileChooser。但是,例如,当FileChooser仍然打开时,我可以关闭原始舞台,或者我仍然可以单击并切换实际窗口。检查下面的代码
我的问题是:
1-关闭主窗口时如何关闭FileChooser?
2-打开FileChooser后如何使主窗口不可单击?
package application;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.AnchorPane;
import javafx.stage.FileChooser;
import javafx.stage.Modality;
import javafx.stage.Stage;
import javafx.stage.Window;
public class Main extends Application {
@Override public void start(Stage stage) {
stage.setTitle("Main Stage");
stage.setWidth(500);
stage.setHeight(500);
stage.show();
Button button = new Button();
AnchorPane ap = new AnchorPane();
Scene scene = new Scene(ap);
ap.getChildren().addAll(button);
stage.setScene(scene);
button.setOnAction(new EventHandler<ActionEvent>() {
@Override public void handle(ActionEvent e) {
FileChooser fileChooser = new FileChooser();
Stage stage2=new Stage();
stage2.initOwner(stage);
stage2.initModality(Modality.WINDOW_MODAL);
fileChooser.showOpenDialog(stage2); …Run Code Online (Sandbox Code Playgroud) 我在互联网上看到了很多这个问题,但所有解决方案对我都不起作用..
所以这就是问题所在.我想要一个屏幕宽度为50%的按钮(工作正常).
但现在我希望它与宽度具有相同的高度.
不知怎的,这不起作用:
Button button1 = (Button) findViewById(R.id.button1);
int btnSize = button1.getLayoutParams().width;
button1.setLayoutParams(new LinearLayout.LayoutParams(btnSize, btnSize));
Run Code Online (Sandbox Code Playgroud)
请参阅以下代码:
Activity1.java:
package nl.jesse.project1;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Button;
import android.widget.LinearLayout;
public class Activity1 extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_activity1);
Button button1 = (Button) findViewById(R.id.button1);
int btnSize = button1.getLayoutParams().width;
System.out.println(btnSize);
//button1.setLayoutParams(new LinearLayout.LayoutParams(btnSize, btnSize));
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if …Run Code Online (Sandbox Code Playgroud) 我有这个代码,它意味着在Instruction按下项目按钮时更改标签的文本.它不是出于某种原因,我不完全确定原因.我尝试在press()函数中创建另一个按钮,除了不同的文本外,它们具有相同的名称和参数.
import tkinter
import Theme
import Info
Tk = tkinter.Tk()
message = 'Not pressed.'
#Sets window Options
Tk.wm_title(Info.Title)
Tk.resizable(width='FALSE', height='FALSE')
Tk.wm_geometry("%dx%d%+d%+d" % (720, 480, 0, 0))
#Method run by item button
def press():
message = 'Button Pressed'
Tk.update()
#item button
item = tkinter.Button(Tk, command=press).pack()
#label
Instruction = tkinter.Label(Tk, text=message, bg=Theme.GUI_hl2, font='size, 20').pack()
#Background
Tk.configure(background=Theme.GUI_bg)
Tk.mainloop()
Run Code Online (Sandbox Code Playgroud) 我从另一个类获取EventHandler,我想将此EventHandler和其他ActionEvent设置为相同的按钮.有可能的?
代码如下.按钮是:"btnAdd".
public void addActionListener(EventHandler<ActionEvent> eventHandlerSetNotSave){
btnAdd.setOnAction((e)-> {
FileChooser fileChooser = new FileChooser();
fileChooser.setTitle("Open Resource File");
FileChooser.ExtensionFilter extFilter = new FileChooser.ExtensionFilter("pictures file format",
"*.TIF","*.JPG","*.PNG","*.GIF","*.JEPG");
fileChooser.getExtensionFilters().addAll(extFilter);
File file = fileChooser.showOpenDialog(null);
if (file != null &&
url.equals(emptyImageUrl)? true:alertMessageWarning("The viseme will change, and previous viseme will be delete.")) {
setImage("file:"+file.toString());
changeAfterSaved=false;
}
});
btnAdd.setOnAction(eventHandlerSetNotSave);
btnDelete.setOnAction((e)-> {
changeAfterSaved=true;
setImage(emptyImageUrl);
});
}
Run Code Online (Sandbox Code Playgroud) 我正在创建一个HTML5 Web表单.其中一个输入是用于地理定位,它通过单击按钮(它插入gps坐标)来填充.由于这个输入必须是必需的并且必须是只读的(我不希望用户在里面写自定义数据),如何处理这个?HTML5不允许使用required和readonly(这是有道理的),但在我的情况下,我需要应用它.你知道任何解决方法吗?
我在这里搜索和搜索了SO和谷歌,但似乎没有人知道解决方案.
这是我的代码的一部分:
<form class="form-horizontal" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<div class="form-group">
<label class="control-label col-xs-3" for="coord">GPS coordinates:*</label>
<div class="col-xs-4">
<input type="text" class="form-control" id="coord" name="coord" required placeholder="Please enable geolocation service">
</div>
<div class="col-xs-3">
<button type="button" onclick="getLocation()" class="btn btn-primary" id="locate" disabled>Locate me</button>
</div>
</div>
Run Code Online (Sandbox Code Playgroud) button ×10
android ×2
java ×2
javafx ×2
onclick ×2
python-3.x ×2
tkinter ×2
action ×1
alignment ×1
animation ×1
arguments ×1
audio ×1
bounce ×1
events ×1
filechooser ×1
height ×1
html ×1
html5 ×1
ibaction ×1
javafx-8 ×1
javascript ×1
label ×1
python ×1
r ×1
readonly ×1
required ×1
shiny ×1
swift ×1
width ×1
windows ×1
xcode ×1