标签: button

自定义Facebook登录按钮

我正在使用Facebook登录按钮让用户通过Facebook登录我的服务.但默认的Facebook登录按钮不符合我的应用程序设计预期.我希望facebook登录按钮就像电子邮件按钮; 圆形,中间有"f"(见附图).我尝试将按钮的背景设置为自定义背景.

这是自定义按钮的代码:

  <?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="oval">
    <solid
        android:color="#E1C8FF"
        />
</shape>
Run Code Online (Sandbox Code Playgroud)

这是按钮XML:

<com.facebook.login.widget.LoginButton
            android:id="@+id/btn_facebook_signup"
            android:layout_width="90dp"
            android:layout_height="90dp"
            android:layout_margin="8dp"
            android:src="@drawable/ic_fb_login"
            facebook:com_facebook_login_text=""
            android:background="@drawable/round_button"/>
Run Code Online (Sandbox Code Playgroud)

有没有办法从按钮中删除那个白色的facebook图标?

图片

android button facebook-sdk-4.0

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

Python Kivy:如何在单击按钮时调用函数?

我在使用kivy库方面很新。

我有一个app.py文件和一个app.kv文件,我的问题是我不能在按下按钮时调用函数。

app.py:

import kivy
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.button import Button

class Launch(BoxLayout):
    def __init__(self, **kwargs):
        super(Launch, self).__init__(**kwargs)

    def say_hello(self):
        print "hello"


class App(App):
    def build(self):
        return Launch()


if __name__ == '__main__':
    App().run()
Run Code Online (Sandbox Code Playgroud)

app.kv:

#:kivy 1.9.1

<Launch>:
    BoxLayout:
        Button:
            size:(80,80)
            size_hint:(None,None)
            text:"Click me"
            on_press: say_hello
Run Code Online (Sandbox Code Playgroud)

python function button kivy

2
推荐指数
2
解决办法
7638
查看次数

如何将Enter键绑定到Tkinter按钮

我试图将Enter键与按钮绑定。

在下面的代码中,我试图从条目小部件中获取条目,当bt按下按钮时,它将调用enter()获取条目的方法。

我也希望通过按Enter键来调用它,但没有得到想要的结果。

在输入小部件中输入的值未读取,调用了enter方法,仅在我的数据库中插入了一个空格

帮我找出我的问题,谢谢!

from tkinter import *
import sqlite3

conx = sqlite3.connect("database_word.db")

def count_index():
    cur = conx.cursor()
    count = cur.execute("select count(word) from words;")
    rowcount = cur.fetchone()[0]
    return rowcount

def enter():  #The method that I am calling from the Button
    x=e1.get()
    y=e2.get()
    ci=count_index()+1
    conx.execute("insert into words(id, word, meaning) values(?,?,?);",(ci,x,y))
    conx.commit()

fr =Frame()  #Main
bt=Button(fr)  #Button declaration
fr.pack(expand=YES)
l1=Label(fr, text="Enter word").grid(row=1,column=1)
l2=Label(fr, text="Enter meaning").grid(row=2,column=1)
e1=Entry(fr)
e2=Entry(fr)
e1.grid(row=1,column=2)
e2.grid(row=2,column=2) …
Run Code Online (Sandbox Code Playgroud)

python bind tkinter button tkinter-entry

2
推荐指数
2
解决办法
9874
查看次数

pygame按钮单击

我在pygame中制作了用于单击事件的按钮,但是存在问题。当我单击鼠标按钮并在按钮边界之间移动鼠标时,单击事件会重复发生。我只想单击一下,直到释放鼠标按钮。我怎样才能做到这一点?

import pygame,time
pygame.init()
x,y = (200,300)
pencere = pygame.display.set_mode((x,y))
pygame.display.set_caption("Click")

white = (255,255,255)
black = (0,0,0)
black2 = (30,30,30)

class Counter:
    count = 0
    def click(self):
        self.count += 1

number = Counter()
def text_objects(text, font, color):
    textSurface = font.render(text, True, color)
    return textSurface, textSurface.get_rect()

def button(msg,x,y,w,h,c,ic,action=None):
    mouse = pygame.mouse.get_pos()
    click = pygame.mouse.get_pressed()
    pygame.draw.rect(pencere, c,(x,y,w,h))

    smallText = pygame.font.Font("freesansbold.ttf",20)
    textSurf, textRect = text_objects(msg, smallText, white)
    textRect.center = ( (x+(w/2)), (y+(h/2)) )
    pencere.blit(textSurf, textRect)

    if x+w > mouse[0] > x and y+h …
Run Code Online (Sandbox Code Playgroud)

python mouse pygame click button

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

React Native:onPress:如何切换按钮文本和函数调用?

我有一个看起来像这样的按钮......

<View style={styles.addToFavoritesStyle}>
  <Button onPress={this.addToFavorites}>ADD TO FAVORITES</Button>
</View>

addToFavorites() {
  ...run some code
}
Run Code Online (Sandbox Code Playgroud)

用户按下按钮后,如何将按钮文本更改为"从收藏中删除",更改按钮样式,并调用其他功能?

button toggle react-native onpress

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

Python 3 tkinter:切换按钮

我想用以下描述创建我自己的小部件:有三个按钮标记为低,中,高.任何时候要么没有激活它们,要么只激活一个.被激活的那个应该有一个凹陷的浮雕.如果我点击一个按钮,应该提升所有其他按钮的浮雕,同时应该激活按钮.我如何在tkinter python3上实现这个?我能够为一个按钮执行此操作:此功能先前已定义:

def toggleLowDeer():
    if DeerLowButton.config('relief')[-1] == 'sunken':
        DeerLowButton.config(relief="raised")
    else:
        DeerLowButton.config(relief="sunken")
Run Code Online (Sandbox Code Playgroud)

之后创建按钮

DeerLowButton = Button(root, text="L", width=1, relief="raised", 
command=toggleLowDeer)
DeerLowButton.place(x=10, y=280)
Run Code Online (Sandbox Code Playgroud)

python tkinter button

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

Vue中v-for循环期间的动态“单击”事件

我正在遍历一个数组,该数组将几个按钮输出到一个表中。我想动态设置单击该按钮时调用的方法。它正确地从数组中提取了其他所有内容,但未设置方法(因此,单击按钮时不执行任何操作)

这是我的v-for循环代码:

<tr v-for="button in buttons" :key="button.id">
   <td>
      <button @click="button.method">{{button.name}}</button>
   </td>
</tr>
Run Code Online (Sandbox Code Playgroud)

这是Vue组件的数据对象中的代码

 buttons : [
            {id : 1, name : 'Button 1', method : 'buttonOne'},
            {id : 2, name : 'Button 2', method : 'buttonTwo'},
        ],
Run Code Online (Sandbox Code Playgroud)

如果我手动设置调用的方法,则一切正常。但是每个按钮都调用相同的方法。而不是“ buttonOne,buttoneTwo等”

<button @click="buttonOne">{{button.name}}</button> //This works but each button has the buttonOne method being called on-click
Run Code Online (Sandbox Code Playgroud)

dynamic button vue.js v-for

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

多个JavaScript按钮简化为一个功能

我有三个按钮和三个JS功能,可以切换三个不同div的显示.如何将我的三个JS函数简化/压缩成一个将每个按钮连接到相应内容的函数?

例:

HTML按钮

<button onclick="myFunction1()">Button 1</button>
<button onclick="myFunction2()">Button 2</button>
<button onclick="myFunction3()">Button 3</button>
Run Code Online (Sandbox Code Playgroud)

HTML内容

<div id="ContentOne">This is Content One.</div>
<div id="ContentTwo">This is Content Two.</div>
<div id="ContentThree">This is Content Three.</div>
Run Code Online (Sandbox Code Playgroud)

JavaScript的

function myFunction1() {
    var x = document.getElementById("ContentOne");
    if (x.style.display === "none") {
        x.style.display = "block";
    } else {
        x.style.display = "none";
    }
}

function myFunction2() {
    var x = document.getElementById("ContentTwo");
    if (x.style.display === "none") {
        x.style.display = "block";
    } else {
        x.style.display = "none";
    }
}

function myFunction3() {
    var x …
Run Code Online (Sandbox Code Playgroud)

html javascript button simplify

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

在Android Studio上禁用了“应用更改”

问题:
使用Android Studio的一些人知道,如果我们想为我们的应用程序应用更改,则必须单击“应用更改”。
我现在的问题是此按钮被禁用/显示为灰色,因此我什至无法单击它。
这是我的意思:
这就是我的意思

到目前为止,
我尝试了什么:我在这里尝试了此链接的解决方案,但没有成功,“无效的缓存/重新启动”或“使用Gradle文件同步项目”都没有:

你们当中有人知道我还能尝试做什么吗?

android button android-studio

2
推荐指数
3
解决办法
1852
查看次数

为什么textView"Hello world!" 屏幕上没有显示?

我试图添加更多,TextViews但它们没有出现在屏幕上,它告诉我"这个视图没有约束.它只有设计时间位置,所以它会在运行时跳转到(0,0),除非你添加约束".

照片: 照片 照片

android button textview

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