标签: button

自定义UIButton图像iOS

是否可以拥有一个自定义UIButton,其图像只覆盖其中的一半?我想它会是这样的:

UIButton *someButton = [UIButton buttonWithType:UIButtonTypeCustom];
[someButton setBackgroundImage:[UIImage imageNamed:@"buttonPicture"]];

/* Then there must be some property I can set that prevents the button from stretching the image?? */

.
.
.
Run Code Online (Sandbox Code Playgroud)

我希望有一个50x100px按钮,上半部分只有50x50px图像,下半部分透明.

我知道如何创建自定义按钮和一切.我只是想知道什么属性控制backgroundImage的拉伸.

谢谢!

iphone image button ipad ios

5
推荐指数
1
解决办法
6393
查看次数

用于启动URL的Xcode按钮

我创建了一个简单的应用程序,底部工具栏中有一个按钮,我似乎无法使按钮工作.我试图附加一个动作,它会在按下时打开一个URL,但它不起作用.所以我已经删除了那个动作,我希望有人可以提供帮助.我已经在这个URL上发布了压缩的xcode项目https://www.box.com/s/5d45ce1df7d9dd0fe205

任何帮助表示赞赏.

xcode button

5
推荐指数
1
解决办法
2万
查看次数

如何在ListView上使用Button的onClickListener方法

我有一个ListView包含a 的自定义Button.此按钮的功能是删除按钮.每当用户单击此按钮时,将删除当前行.

  • 我该怎么做?
  • 如何设置onClickListener此按钮?
  • 如何捕获此按钮所在的行ID?

提前致谢.

android button android-listview onclicklistener

5
推荐指数
1
解决办法
2万
查看次数

如何使用tkinter/ttk在Python 3中显示图像?

问题的核心是,我在下面的代码片段中做错了什么?

    from tkinter import *
    from tkinter.ttk import *

    root = Tk()

    myButton = Button(root)
    myImage = PhotoImage(myButton, file='myPicture.gif')
    myButton.image = myImage
    myButton.configure(image=myImage)

    root.mainloop()
Run Code Online (Sandbox Code Playgroud)

我从idle3得到的错误信息如下:

    >>> 
    Traceback (most recent call last):
      File "/home/bob/Documents/Python/tkImageTest.py", line 9, in <module>
        myButton.configure(image=myImage)
      File "/usr/lib/python3.2/tkinter/__init__.py", line 1196, in configure
        return self._configure('configure', cnf, kw)
      File "/usr/lib/python3.2/tkinter/__init__.py", line 1187, in _configure
        self.tk.call(_flatten((self._w, cmd)) + self._options(cnf))
    TypeError: __str__ returned non-string (type Button)
    >>> 
Run Code Online (Sandbox Code Playgroud)

这个错误信息让我难过,我根本不明白它想说的是什么.有任何想法吗?

我也很感激改变的建议......

image tkinter button ttk python-3.x

5
推荐指数
1
解决办法
2万
查看次数

如何使用js向td添加按钮?

我有一个动态生成的表,因为它正在生成其TD,我想将第一个TD设置为按钮.下面是我的代码,显然不起作用.我记得我遇到的另一个问题是我们可以使用.html()更改div的内容,但这里也不起作用.

码:

    var table = document.getElementById("userinfo");
    var thead, tr, td;
    table.appendChild(thead = document.createElement("thead"));
    thead.appendChild(tr = document.createElement("tr"));
    tr.appendChild(td = document.createElement("td"));
    td.innerHTML = "Email";
    tr.appendChild(td = document.createElement("td"));
    td.innerHTML = "First Name";
    tr.appendChild(td = document.createElement("td"));
    td.innerHTML = "Last Name";
    tr.appendChild(td = document.createElement("td"));
    td.innerHTML = "Is Active?";

    for (var i in data)
    {
        tr = document.createElement("tr");
        tr.setAttribute("id", "row" + i);
        if (i%2 == 0)
        {
            tr.setAttribute("style", "background:white");
        }

        var entry = data[i];
        console.log(entry);
        table.appendChild(tr);
        tr.appendChild(td = document.createElement("td"));
        td.setAttribute("html", "<input type=\"button\" class=\"btn\" value=\'" + entry.email …
Run Code Online (Sandbox Code Playgroud)

javascript button

5
推荐指数
1
解决办法
3万
查看次数

仅限按钮左侧的边框

这是我的button_style.xml,其中包含我的按钮.但是,我似乎仍然无法获得左边的边框.有人可以帮我吗?

ps - 我的背景应该是透明的

<?xml version="1.0" encoding="utf-8"?>
<selector  xmlns:android="http://schemas.android.com/apk/res/android" >
    <layer-list>
            <item android:left="2dp">
                <shape android:shape="rectangle"> 
                    <stroke
                        android:width="1dp"
                        android:color="#999999"/>
                </shape>
        </item>
    </layer-list>

</selector>
Run Code Online (Sandbox Code Playgroud)

android styles border button

5
推荐指数
2
解决办法
1万
查看次数

Android中的非传统GUI设计

我有一个与android中的GUI设计有关的问题.
如果您看一下Android设计架构,我们在设计视图中有表格结构.我们可以按行和列绘制按钮,我们可以绘制图像视图等等,但我们将在矩阵中进行所有操作.... 如下图所示. 在此输入图像描述

但我在Android中看到了许多有趣的GUI设计,它看起来非常漂亮,看起来不像传统的设计视图(矩阵形式).

用锯齿形按钮检查下图.我画了红色方块. 在此输入图像描述

我不确定它是如何设计的以及如何捕获不同图像和按钮的onclick功能.我希望我能很好地解释我的问题,请告诉我是否不清楚.我寻求健康的反应和帮助.

user-interface android button

5
推荐指数
1
解决办法
237
查看次数

点击android widget按钮上的监听器

我是android开发的新手.我想在小部件的按钮上添加点击监听器.我正在更新服务中的小部件.提前致谢.

android onclick button android-widget

5
推荐指数
1
解决办法
8677
查看次数

跨多个控件共享事件处理程序

在用C#编写的Windows窗体应用程序中,我有一堆按钮.当用户的鼠标悬停在按钮上时,我希望按钮的边框发生变化.

目前我有以下多个实例(每个按钮的副本):

private void btnStopServer_MouseEnter(object sender, EventArgs e)
{
    oldColor = btnStopServer.FlatAppearance.BorderColor;
    btnStopServer.FlatAppearance.BorderColor = mouseOverColor;
}

private void btnStopServer_MouseLeave(object sender, EventArgs e)
{
    btnStopServer.FlatAppearance.BorderColor = oldColor;
}
Run Code Online (Sandbox Code Playgroud)

由于我有很多按钮,更改按钮边框颜色的代码占用了大量空间.

有没有更简单的方法可以做到这一点?

c# optimization button event-handling winforms

5
推荐指数
1
解决办法
2720
查看次数

CSS - 按钮不时无法点击?

我有多个锚元素.偶尔点击它们什么都不做,所有CSS动画都可以工作,但链接没有打开任何页面/触发任何动作.我必须稍微移动光标然后再次单击.

我确定这是一个CSS问题,但我在CSS中找不到任何错误.我认为这个问题可能存在于边缘(4px底部边缘但是4px上边距:活跃)但我在很多网站上都看到了这个并且按钮工作得很好......

这是按钮.点击它们,大约20次点击中的一次不起作用(有时它会在第一次点击时发生):

http://jsfiddle.net/4nz4v/(注意按钮在点击后没有获得.active类,在最新的Opera和Chrome中测试过)

这是CSS:

.button {
    display: inline-block;
    vertical-align: top;
    color: #000;
    background: #aaa;
    text-shadow: 1px 1px 1px #fff;
    border: 0;
    padding: 0.6em 1.2em;
    margin: 0 0 4px 0;
    text-decoration: none;  
    border-radius: 6px;
}

.button:hover {
    color: #fff;
    text-shadow: none;
}

.button:active {
    margin: 4px 0 0 0;
}

.active {
    background: #fff;
    text-shadow: none;
    color: #000;
}
Run Code Online (Sandbox Code Playgroud)

谢谢.

css margin button hover

5
推荐指数
1
解决办法
727
查看次数