我正在寻找一种方法来创建工具栏按钮uisng jquery ui.
我尝试使用创建按钮
<div id='menubar_home' style='vertical-align: middle;width: 20px; height: 20px;'>
</div>
Run Code Online (Sandbox Code Playgroud)
和使用
$('#menubar_home').button({
icons: { primary: "ui-icon-home" }
});
Run Code Online (Sandbox Code Playgroud)
但按钮中的图像不居中:

如何将图像置于按钮中心?
我试图在悬停时更改xaml中按钮样式的背景颜色这是我当前的方法,但它不起作用.正在使用默认的悬停颜色
<Style x:Key="AtStyle" TargetType="Button">
<Setter Property="Background">
<Setter.Value>
<SolidColorBrush Color="{StaticResource AtBlue}" />
</Setter.Value>
</Setter>
<Setter Property="Foreground" Value="White" />
<Setter Property="Padding" Value="12,6" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="FontSize" Value="18.667" />
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background">
<Setter.Value>
<SolidColorBrush Color="Red" />
</Setter.Value>
</Setter>
</Trigger>
</Style.Triggers>
</Style>
Run Code Online (Sandbox Code Playgroud)
我已经看到其他解决方案,你需要覆盖控制模板来实现这一点,但这些解决方案还需要你定义边框和内容,这似乎是不必要的.在Xaml中定义悬停状态的最小方法是什么?
好吧,所以我有一个列表(也是一个片段对话框),显示一个用户朋友,该列表中的每个项目都有一个按钮(在图片中标记为朋友),当用户点击该按钮ID时,显示另一个显示的片段对话框与该用户交互的所有选项(朋友请求,阻止,发送私人消息等)问题是这个按钮及其onClick监听器目前是通过覆盖我的listview适配器getView方法实现的,并创建一个fragmentDialog需要访问权限片段管理器.有没有办法使这项工作?
编辑:我不能发布项目的实际代码,但我已经附加了一个简化的基本适配器w.onClickListener应该清楚我想要做什么.我无法从基本适配器类访问fragmentManager以使对话框片段成为可能
LazyAdapter.java
package com.example.androidhive;
import java.util.ArrayList;
import java.util.HashMap;
import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
public class LazyAdapter extends BaseAdapter {
private Activity activity;
private ArrayList<HashMap<String, String>> data;
private static LayoutInflater inflater=null;
public ImageLoader imageLoader;
public LazyAdapter(Activity a, ArrayList<HashMap<String, String>> d) {
activity = a;
data=d;
inflater = (LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
imageLoader=new ImageLoader(activity.getApplicationContext());
}
public int getCount() {
return data.size();
}
public Object getItem(int position) {
return position;
}
public long getItemId(int …Run Code Online (Sandbox Code Playgroud) 我有一个.js文件,由几个.jsp页面调用.我在这个特定的.js文件中需要做的是只有在.jsp页面中存在"保存"按钮时才调用某个函数.如何检查按钮是否存在?目前在.js文件中按钮的方式是这样的:$('button [id = save]')
如何检查是否存在这样的按钮?希望有人可以提供建议.谢谢.
我无法完成学期项目的最终工作.我正在开发Connect Four游戏,我想增加JButton内部的字体大小.我对编程比较陌生,但我还没有使用任何字体.我只想将按钮内部的字体加倍,以使其在游戏过程中更加醒目.有人可以帮助我,还是指出我找到解决方案的方向?谢谢!我的代码如下.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Connect implements ActionListener {
private JFrame window = new JFrame("Connect Four by Steven and Anthony");
private JPanel myPanel = new JPanel();
private JPanel myPanelB = new JPanel();
private JButton[][] myButtons = new JButton[6][7];
private JButton[] buttons = new JButton[7];
private boolean win = false;
private int count = 5;
private int count2 = 5;
private int count3 = 5;
private int count4 = 5;
private int count5 = 5;
private …Run Code Online (Sandbox Code Playgroud) 我在父级中有线性垂直布局.然后是底部的水平线性布局,包括3个按钮
我希望活动最左侧的第一个按钮位于中间的第二个按钮和最右侧的第三个按钮
这是xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ImageView
android:id="@+id/viewImageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:contentDescription="@null"
android:src="@drawable/ic_launcher" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom" >
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
<Button
android:id="@+id/button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right"
android:layout_gravity="fill_vertical"
android:text="Button" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
如何创建一个带有两个按钮的窗口的函数,其中每个按钮都有一个指定的字符串,如果单击该按钮,则返回一个指定的变量?类似@在这个视频3:05 https://www.khanacademy.org/science/computer-science-subject/computer-science/v/writing-a-simple-factorial-program---python-2我(知道它是一个非常简单的初学者程序的教程,但它是我能找到的唯一视频)但没有文本框,我对"确定"和"取消"按钮的操作有更多的控制.
我是否必须创建一个窗口,在其中绘制一个带有字符串的矩形,然后创建一个检查鼠标移动/鼠标单击的循环,然后在鼠标坐标位于其中一个按钮内部后返回一些内容,点击鼠标?或者是否有一个函数/函数集可以使按钮窗口更容易?还是一个模块?
我有一个HTML按钮,我希望它通过按一下来下载pdf文件。谢谢
<div class="columns download">
<p>
<a href="images/Portfolio.pdf" class="button"><i class="fa fa-download"></i>Download CV</a>
</p>
</div>
Run Code Online (Sandbox Code Playgroud) 在Swift中,您可以为这样的按钮创建一个函数:
button.addTarget(self, action: #selector(buttonAction), forControlEvents: .TouchUpInside)
Run Code Online (Sandbox Code Playgroud)
但有没有办法可以做到这样的事情:
button.whenButtonIsClicked({Insert code here})
Run Code Online (Sandbox Code Playgroud)
这样我甚至没有为按钮声明一个显式函数.我知道我可以使用按钮标签,但我更愿意这样做.
我有两个问题ion-buttons.
离子文档仅显示ion-buttons元素的用法,除了您可以从示例中推断出的内容之外,没有真正的解释.
什么让我失望的是,在我看来,关键标签是在错误的地方.
当我在文档上看到这个时,我想知道这是不是一个错误,但我也在堆栈的代码示例中看到了这一点.像这个:
<ion-header>
<ion-navbar primary>
<ion-buttons start> **// here it starts.**
<button menuToggle>
<ion-icon name="menu"></ion-icon>
</button>
</ion-buttons> **//Why does ion-buttons close here?**
<ion-title>
My Page
</ion-title>
<ion-buttons end> **// END here?**
<button ion-button icon-only>
<ion-icon name="search"></ion-icon>
</button>
</ion-buttons> **// then close AGAIN here when there is no companion open tag?**
</ion-navbar>
</ion-header>
Run Code Online (Sandbox Code Playgroud) button ×10
android ×2
html ×2
alignment ×1
baseadapter ×1
closures ×1
css ×1
download ×1
fonts ×1
hover ×1
image ×1
ionic2 ×1
java ×1
javascript ×1
jquery ×1
jquery-ui ×1
jsp ×1
listview ×1
module ×1
pdf ×1
python ×1
size ×1
styles ×1
swift ×1
syntax ×1
uibutton ×1
user-input ×1
window ×1
wpf ×1
xaml ×1