我有以下按钮:
<Button
android:id="@+id/buttonok"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/back_no_save"
android:text="OK" />
Run Code Online (Sandbox Code Playgroud)
它的出现是:

如何缩小我的绘图并显示一个小箭头?
是否可以以编程方式设置按钮中文本的字体大小(以像素为单位),而不使用xml样式?使用字体大小=".."的Html.fromHtml(..)没有用.
我想在图像按钮下添加文本,这些文本也是可点击的,并且将被重定向到与图像按钮相同的活动.基本上它就像任何Android手机中的应用程序列表,例如
我有一个DataGridView对象:
dataGridView1.DataSource = an.peaks;
Run Code Online (Sandbox Code Playgroud)
(an.peaks是一个List<Point>对象.type Point有3个属性:x,y,z)
女巫在运行时生成下一个表:(显然我无法上传,Image因为我是一个新用户所以我会尝试绘制它:)
____|_x__|_y__|_z__|[new column ]
____|_11_|_12_|_13_|[text/button] <==\
____|_20_|_30_|_40_|[text/button] <== } Add text if something or button if something else.
____|_50_|_60_|_70_|[text/button] <==/
Run Code Online (Sandbox Code Playgroud)
我想在新列中添加按钮(如图像/图中所示)到满足某些条件的每一行.如果条件不满意,请添加一些文本.
示例:如果数据库中已存在该点,则显示其物质名称(每个点代表一种物质).如果没有将"ADD"按钮添加到将新点添加到数据库的相应行.
条件不是问题 - 它们仅用于示例.问题是为每一行添加按钮/文本,为新按钮添加单击事件.
是否可以向表格中的单元格添加" 删除"按钮?
我有一个包含5列的表,我想添加第6列.我希望第6列在每行中都有一个删除按钮.
示例行:
| 10002 | 部分| 金属| 001 | 是的| Remove |
这样,用户只需单击按钮即可删除任何不需要的行.
我在表中有一个标记列,它是ComboBox.我创建了一个扩展的类EditingSupport.
我是否需要扩展另一个类EditingSupport,但是创建一个按钮而不是ComboBox?
编辑
public class AplotDataTableViewer extends TableViewer
{
public AplotDataTableViewer(Composite parent, int style)
{
super(parent, style);
Table table = getTable();
GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
table.setLayoutData(gridData);
createColumns();
table.setHeaderVisible(true);
table.setLinesVisible(true);
setContentProvider(new ArrayContentProvider());
}
private void createColumns() {
String[] titles = { "ItemId", "RevId", "PRL", "Dataset Name", "EC Markup" };
int[] bounds = { …Run Code Online (Sandbox Code Playgroud) 我正在使用特定的中间件(不重要)在Android中开发一个电视远程模拟器应用程序.
在音量按钮(音量+和音量 - )的情况下,我要做的是在按下按钮时重复发送"音量调高"信号.
这就是我最后尝试的(其中一个按钮的代码,另一个必须相同,除了名称):
声明了一个布尔变量
boolean pressedUp = false;
Run Code Online (Sandbox Code Playgroud)使用以下AsyncTask声明了一个内部类:
class SendVolumeUpTask extends AsyncTask<Void, Void, Void> {
@Override
protected Void doInBackground(Void... arg0) {
while(pressedUp) {
SendVolumeUpSignal();
}
return null;
}
Run Code Online (Sandbox Code Playgroud)
}
将侦听器添加到按钮:
final Button buttonVolumeUp = (Button) findViewById(R.id.volup);
buttonVolumeUp.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
if(pressedUp == false){
pressedUp = true;
new SendVolumeUpTask().execute();
}
case MotionEvent.ACTION_UP:
pressedUp = false;
}
return true;
}
});
Run Code Online (Sandbox Code Playgroud)我也尝试使用简单的线程,如在Increment-Decrement计数器中按下按钮但不起作用.该应用程序可以很好地用于其余按钮(通道等),但完全忽略了音量变化.
我正在尝试将我的按钮的背景图像更改为其他图像,但我遇到了一些错误.这是我在xaml上的代码:
<Button x:Name="Button1" Width="200" Height="200" Content="Button1" Margin="0,0,0,400">
<Button.Background>
<ImageBrush **ImageSource ="Images/AERO.png"** ></ImageBrush>
</Button.Background>
</Button>
Run Code Online (Sandbox Code Playgroud)
和我的cs:
private void Button1_Click_1(object sender, RoutedEventArgs e)
{
var brush = new ImageBrush();
brush.ImageSource = new BitmapImage(new Uri("Images/AERO.png"));
Button1.Background = brush;
}
Run Code Online (Sandbox Code Playgroud)
我在我的xaml上的错误是"文件'Images\logo.png'不是项目的一部分,或者它的'Build Action'属性没有设置为'Resource'.任何人都可以帮我解释一下,谢谢
我正在教自己基本的C#,以开发链接到SQL Server数据库的应用程序.我正在创建一个非常基本的应用程序,它允许我在表单上键入2个值,然后在按钮上单击插入值.我还想要一个单独的按钮,它向我显示ConsoleWindow中表格中的所有数据.插件工作得很好,我现在唯一的问题是当我点击ShowData按钮时没有任何反应,任何想法?
我可以想象这将是一个非常基本的东西,但正如我所说,我还在学习.
public partial class InsertNames : Form
{
public InsertNames()
{
InitializeComponent();
}
private SqlConnection thisConnection = new SqlConnection("Data Source=(localdb)\\V11.0;database=Dev");
private void FirstName_TextChanged(object sender, EventArgs e)
{
string firstName = FirstName.Text;
}
private void LastName_TextChanged(object sender, EventArgs e)
{
string lastName = LastName.Text;
}
private void Insert_Click(object sender, EventArgs e)
{
try
{
thisConnection.Open();
SqlCommand insertCommand = thisConnection.CreateCommand();
insertCommand.CommandText = "INSERT INTO Names (FirstName,LastName) Values (@FirstName, @LastName)";
insertCommand.Parameters.Add("@FirstName", SqlDbType.VarChar, 50).Value = FirstName.Text;
insertCommand.Parameters.Add("@LastName", SqlDbType.VarChar, 50).Value = LastName.Text;
insertCommand.ExecuteNonQuery(); …Run Code Online (Sandbox Code Playgroud) 我正在使用tkinter在python3中编写一个游戏,我在使用网格做我想要它做的事情时遇到了一些麻烦.我已经查看了至少五页的谷歌搜索结果,包括堆栈溢出答案,以及如何提出我能想到的这个问题的每个变体.我终于放弃并创建了这个帐户来询问这个问题.
我得到的:一个按钮(newGameButton)和一个标签(messageBox),它以一个框架(topBar)为中心,它本身居中但不横向覆盖整个窗口(contentFrame).
我设法获得的最好(通过放在sticky=W+EtopBar上):框架现在跨越整个窗口,按钮和标签保持相同的大小(标签上的粘性没有做任何事情,并且按钮上的粘性仅使其成为作为标签的宽度,现在卡在topBar的左侧.
我想要它做的事:让框架跨越整个窗口,标签也跨越整个窗口,按钮居中.
topBar的原因是columnspan=23内容框架中的其余内容是23列宽(包括0列).我在框架中有按钮和标签的原因是我希望围绕它们的整个框具有边框效果.
码:
self.contentFrame = Frame(self.root)
self.contentFrame.grid(row=0, column=0)
self.topBar = Frame(self.contentFrame, border=2, relief=RAISED)
self.topBar.grid(row=0, column=0, columnspan=23)
self.newGameButton = Button(self.topBar, text="New Game")
self.newGameButton.grid(row=0, column=0)
self.messageBox = Label(self.topBar, textvariable=self.message, height=2)
self.messageBox.grid(row=1, column=0, sticky=W+E)
Run Code Online (Sandbox Code Playgroud)
有没有人有任何想法?在这一点上,我非常绝望.
我有一个简单的,我需要每秒更改我的按钮的颜色.我使用此代码btnBlue.Background = new SolidColorBrush(Windows.UI.Colors.Blue)但它不包含我在xaml中使用的自定义颜色#FF30B3DD!所以我该怎么做 ?有谁能够帮我 ?
button ×10
android ×4
c# ×4
background ×2
centering ×1
colors ×1
datagridview ×1
grid ×1
image ×1
imagebutton ×1
java ×1
jface ×1
python ×1
row ×1
scale ×1
sql ×1
sql-server ×1
swt ×1
tableviewer ×1
tkinter ×1
touch-event ×1
wpf ×1