我想将按钮中的文本对齐到左侧,但根本不想。
为了清楚起见,请查看图像中的红色圆圈。

谢谢。
(图像中的第一个是我的结果,第二个是我想要的)
xml代码:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/activity_libretto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:orientation="vertical"
>
<Button
android:id="@+id/button"
style="?android:attr/borderlessButtonStyle"
android:textAllCaps="false"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:text="Buongiorno!"
android:textSize="19dp"
android:textStyle="bold"
android:layout_marginTop="15dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="20dp"
android:gravity="left|center_vertical"
android:background="@drawable/bg_button"
android:drawableRight="@drawable/arrow"
/>
Run Code Online (Sandbox Code Playgroud) 我一直在使用 tkinter 编写一段简单的 python 3.4 代码。它是 D&D 的骰子滚轮。它有用于所有基本骰子的按钮,还有一个允许您输入骰子面数的按钮。
我的布局方式让我想起了键盘,所以我想我应该添加一些东西,让你可以通过按下按钮来单击按钮。我弄清楚了单击按钮以调用函数的系统,但我不知道如何使按钮动画运行。
有没有办法做到这一点?请帮忙。谢谢!
from tkinter import *
import tkinter.simpledialog as simpledialog
from random import randint
import os
root = Tk()
root.title("Die Roller")
root.geometry("200x215")
app = Frame(root)
app.grid()
v = StringVar()
w = Label(root, textvariable= v)
w.grid()
print("Results:")
def ad4():
x = randint(1,4)
v.set(x)
print(x)
def ad6():
x = randint(1,6)
v.set(x)
print(x)
def ad8():
x = randint(1,8)
v.set(x)
print(x)
def ad10():
x = randint(1,10)
v.set(x)
print(x)
def ad12():
x = randint(1,12)
v.set(x)
print(x)
def …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用项目中的按钮打开 pdf 文件。
鉴于此代码:
<button type=submit class="btn btn-danger" onclick=" window.open('file:////C:\Users\data'); return true;"> PDF </button>
Run Code Online (Sandbox Code Playgroud)
它只是打开一个关于:空白页面。好像出了什么问题?
我是 Android 应用程序开发的新手,我意识到,归根结底,对最终用户来说真正重要的是应用程序的 UI。
当涉及到 UI 时,我总是尽力做到最好,但最终总是遇到一些麻烦。特别是,我一直遇到且不知道如何解决的主要问题之一是,当我为某个按钮设置自定义背景颜色或图像时,点击效果消失。因此,您单击该按钮,尽管它显然可以工作,但看到它以图形方式不执行任何操作还是非常令人不快的。
我想知道是否有某种方法可以恢复原始效果,或者以编程方式自己设置一些点击效果。
提前致谢。
我已经四处寻找,但无论我尝试什么,我都无法使我的按钮全局边框半径为零。这不起作用,任何人都可以帮忙吗?谢谢!
.btn btn-default{
border-radius: 0px!important;
-webkit-border-radius: 0px!important;
-moz-border-radius: 0px!important;
}
Run Code Online (Sandbox Code Playgroud) 我想设置a的背景颜色Button。我正在将 Visual Studio 与 Xamarin 一起使用。
在Android中我们使用:
Java代码:
button_vstrong_fluorescence.setBackgroundColor(ContextCompat.getColor(InventoryActivity.this, R.color.linear_filter_background));
Run Code Online (Sandbox Code Playgroud)
但在 Xamarin C#代码中。
button_vstrong_fluorescence.SetBackgroundColor(Android.Graphics.Color.ParseColor("#EBECEC"));
Run Code Online (Sandbox Code Playgroud)
在C#中中,上面的代码工作正常。
但每次我想要以静态方式正确处理这件事
Android.Graphics.Color.ParseColor("#EBECEC")
Run Code Online (Sandbox Code Playgroud)
有什么办法可以设置吗#EBECEC从我的资源中设置这种颜色。
要求Color.ParseColorString如此。
Android.Graphics.Color.ParseColor(Resource.Colors.linear_filter_background.ToString);
Run Code Online (Sandbox Code Playgroud)
但它给了我以下错误。
有没有办法从资源中设置背景颜色?
任何帮助都值得赞赏。
ButtonKivy可以制作透明吗?
仅供参考,这里是页面代码:
class home(Screen):
def __init__(self,**kwargs):
super (home,self).__init__(**kwargs)
bkg = GridLayout(cols = 1)
i = Image(source='/Users/User/Downloads/im3.jpg',y = bkg.height)
bkg.add_widget(i)
my_box1 = BoxLayout(orientation='vertical')
my_button1 = Button(text="Run tests",size_hint_y=None, size_y=100)
my_button2 = Button(text="View VG images",size_hint_y=None, size_y=100)
my_button3 = Button(text="View test logs",size_hint_y=None, size_y=100)
my_button1.bind(on_press=self.run)
my_button2.bind(on_press=self.vg)
my_button3.bind(on_press=self.logs)
my_box1.add_widget(my_button1)
my_box1.add_widget(my_button2)
my_box1.add_widget(my_button3)
self.add_widget(bkg)
self.add_widget(my_box1)
def run(self,*args):
self.manager.current = 'RunTests'
def vg(self,*args):
self.manager.current = 'vgMenu'
def logs(self,*args):
self.manager.current = 'logs'
Run Code Online (Sandbox Code Playgroud) 我正在创建一个文本和按钮列表。我想确定在单击的函数中单击了哪个按钮。
超文本标记语言
<ion-list>
<ion-item ion-item *ngFor="let act of questions.test">
{{act.quote}}
<ion-item>
<button large ion-button item-right (click)="SelectClicked()">Select</button>
</ion-item>
</ion-item>
</ion-list>
Run Code Online (Sandbox Code Playgroud)
TS
this.questions =
{
"test":[
{
"quote": "first row"
}, {
"quote": "second row"
}, {
"quote": "third row"
}, {
"quote": "fourth row"
}
]
}
SelectClicked(detail){
//please help
// which button was clicked ( 1 to 4 ) ?
console.log("SelectClicked" + detail);
}
Run Code Online (Sandbox Code Playgroud) 我正在使用 gtk3 并使用以下代码片段将图像放入按钮中。
GtkWidget *button1 = gtk_button_new();
gtk_widget_set_size_request (button1, 100, 60);
gtk_fixed_put (GTK_FIXED (wfixed), button1, 20, 30);
GtkWidget *img = gtk_image_new_from_file("handset-release.png");
gtk_container_add (GTK_CONTAINER (button1), img);
Run Code Online (Sandbox Code Playgroud)
问题是按钮不再是 100x60,而是调整大小以适应现在尺寸更大的图像。这在 gtk2 中没有发生,图像会被裁剪,而按钮仍保持 100x60。我不想调整按钮的大小。发生这种情况的任何原因。
提前致谢。
我正在使用 sendGrid 向用户发送电子邮件验证邮件,当用户单击“验证”按钮时,它将被重定向到另一个链接,我已成功发送电子邮件,但我不知道如何使按钮动态?
我读到了有关内容substitution,但不知道如何将其与按钮一起使用,我已在代码中添加了以下行
email.addSubstitution(VERIFY_TOKEN_KEY, new String[] { token.getToken() });
Run Code Online (Sandbox Code Playgroud)
这是我在 SendGrid 上的按钮代码
<a style="background-color:#51a9a4;border:1px solid #333333;border-color:#333333;border-radius:6px;border-width:1px;color:#ffffff;display:inline-block;font-family:arial,helvetica,sans-serif;font-size:16px;font-weight:normal;letter-spacing:0px;line-height:16px;padding:12px 18px 12px 18px;text-align:center;text-decoration:none;"
href="-verifyLink-" target="_blank">Verify</a>
Run Code Online (Sandbox Code Playgroud)
href 里应该写什么?