标签: button

将进度条定位在按钮后面

我有一个Button定义RelativeLayout如下:

<Button
        android:id="@+id/search_button"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/current_location"
        android:layout_marginLeft="5dp"
        android:layout_marginRight="5dp"
        android:paddingBottom="30dp"
        android:paddingTop="30dp"
        android:text="@string/search" />
Run Code Online (Sandbox Code Playgroud)

我想在Button后面添加一个ProgressBar,占用与Button完全相同的空间,这样当按钮被禁用(半透明)时,你可以看到它背后的进度条.我该怎么做?

layout android button relativelayout progress-bar

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

警报对话框未显示在MainActivty启动

当我运行我的应用程序时,对话框没有弹出,我错过了什么?

这是我的代码:

AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage("This is a test!")
   .setCancelable(false)
   .setPositiveButton("I Agree", new DialogInterface.OnClickListener() {
       public void onClick(DialogInterface dialog, int id) {
            MainScreen.this.finish();
       }
   })
   .setNegativeButton("I Disagree", new DialogInterface.OnClickListener() {
       public void onClick(DialogInterface dialog, int id) {
            dialog.cancel();
       }
   })
   //Set your icon here
   .setTitle("Alert!")
   .setIcon(R.drawable.ic_launcher);
AlertDialog alert = builder.create();
Run Code Online (Sandbox Code Playgroud)

所有帮助表示赞赏.

eclipse android dialog button

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

Android中的Intent问题

final Button OptButton = (Button) findViewById(R.id.OptButton);
        OptButton.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                Intent OptionsSc = new Intent(this, OptionsActivity.class);
                startActivity (OptionsSc);
            }
        });
Run Code Online (Sandbox Code Playgroud)

Eclipse一直强调这new Intent(this, OptionsActivity.class);部分,我不明白为什么.以前,对OptionsActivity的调用已分配给硬件搜索按钮,一切正常.

eclipse android button android-intent

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

asp.net弹出确认窗口

我需要在删除按钮中添加一个"你确定"的弹出窗口,我不知道如何确定用户是单击确定还是取消.

我是这样做的:

string message = "Are you sure you want to delete this user?";
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            sb.Append("return confirm('");
            sb.Append(message);
            sb.Append("');");
            Type type = this.GetType();
            ClientScript.RegisterOnSubmitStatement(type, "alert", sb.ToString());
Run Code Online (Sandbox Code Playgroud)

c# asp.net popup button

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

根据pygame中的点击更改图片

我已经完成了一次Google搜索,并搜索了我的两本python初学者书籍,以查找执行此操作的方法。我认为这必须是一个简单的任务。基本上,我正在与python一起使用pygame。

我想要如果我单击button1_image,它将更改为button1select_image,对吗?如果单击button2_image,它将button1select_image设置回button1_image,而button2_image更改为button2select_image。

所以我想知道的是,这是一个简单的if else语句还是更为复杂。显然,这些按钮稍后会执行其他操作,但是我无法找到基于如何通过单击用户鼠标来执行类似操作的教程。

# Button Mouse Click Image Change
# Demonstrates changing from one button image to another based on click of mouse.

from livewires import games, color

games.init(screen_width = 281, screen_height = 500, fps = 50)

button1_image = games.load_image("button1.png", transparent = False)
button1 = games.Sprite(image = button1_image, x = 28,y = 18)
games.screen.add(button1)

button1select_image = games.load_image("button1select.png", transparent = False)
button1select = games.Sprite(image = button1select_image, x = 28,y = 18)
games.screen.add(button1select)

button2_image = games.load_image("button2.png", transparent = False)
button2 = …
Run Code Online (Sandbox Code Playgroud)

python pygame onclick button

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

动态添加Jquery删除按钮不起作用

毫无疑问这很简单,但是我对jquery缺乏了解,这对我来说很复杂.基本上我有这个代码:

$(document).ready( 
    function() {
    $( "#remove")
    .click(function() {
        alert("I have been clicked!");
        $(this).parent().parent().remove();
    }); 
});
Run Code Online (Sandbox Code Playgroud)

我在表格中添加了一个按钮,用于删除它的行(参见上面的代码).按钮如下:

<td ><button id='remove' type='button'>Remove</button></td>
Run Code Online (Sandbox Code Playgroud)

但是,点击时它什么都不做.我认为这可能与文档加载后创建按钮的事实有关...但不知道如何处理它.

jquery button document-ready

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

input [type ="submit"]:选择CSS不起作用

我有一个.css样式表,其中包含我的输入类型按钮的样式,如下所示.

input[type="submit"]
input[type="submit"]:hover
input[type="submit"]:focus
Run Code Online (Sandbox Code Playgroud)

以上三件作品但input[type="submit"]:select不起作用.我甚至试过了:selected.请问:visited,:link等申请<input type="button" />和<input type="submit" />?

请帮我怎么input[type="submit"]:select去上班

css submit button onselect

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

带按钮的Android自定义对话框

今天非常简单的问题.当我尝试检索对话框上的按钮的引用时,我总是收到一个空值.

@Override
public void onRestart() {
    super.onRestart();


    //must prompt with modal dialog for pin
    Dialog dialog = new Dialog(this);
    dialog.setOwnerActivity(this);
    dialog.setCancelable(false);

    //check pin
    dialog.setCanceledOnTouchOutside(false);
    //set view to enterpin XML screen
    dialog.setContentView(R.layout.enterpin);
    //register button

    //show dialog
    dialog.show();
    //listen for button being clicked
    Button button = (Button) findViewById(R.id.pinlogin);
    button.setOnClickListener(new OnClickListener(){
        @Override
        public void onClick(View v){
            EditText editText = (EditText) findViewById(R.id.enterpin);
            int enteredPin = Integer.parseInt(editText.getText().toString());
            SharedPreferences sharedP = getPreferences(MODE_PRIVATE);
            int temp = sharedP.getInt("pin", 0);
            if(enteredPin==temp){
                pinCheck = true;
            }else{
                pinCheck = false;
            } …
Run Code Online (Sandbox Code Playgroud)

java xml android button

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

textColor以样式定义,未应用于按钮文本

我的应用程序中有几个按钮,我想将样式应用于所有这些按钮.

以下是我放在我的values文件夹中的styles.xml文件.

<?xml version="1.0" encoding="utf-8"?>

 <resources>

     <style name="buttonStyle">
      <item name="android:textStyle"> bold </item>
      <item name="android:textColor"> #282780 </item>
      <item name="android:textSize"> 20sp </item>
     </style>

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

在我的布局xml文件中,我使用按钮内的样式如下,

<Button android:id="@+id/ok_preview_appointment_button" 
        android:text="@string/ok_preview_appointment_button"
        android:layout_width="175dp"
        android:layout_height="35dp"
        android:layout_marginBottom="10dp"
        style="@style/buttonStyle"
        android:background="@drawable/button_background" />
Run Code Online (Sandbox Code Playgroud)

我收到以下错误"java.lang.NumberFormatException:颜色值'#282780'必须以#开头"

我检查了其他线程,但他们似乎都遇到这个问题,当他们使用@color,这不是我的情况.

先感谢您!

java android styles colors button

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

如何在android中的按钮点击事件中看到textview

我开发了一个简单的应用程序,其中包含一个textview.and我的问题是我希望在按钮单击事件的隐形文本视图中可见.

在加载时,我这样做

myTextView.setVisible(View.GONE);
Run Code Online (Sandbox Code Playgroud)

在Button Click事件之后,我这样做.

myTextView.setVisible(View.VISIBLE);
Run Code Online (Sandbox Code Playgroud)

textview是可见的,但它在下面重叠TextView意味着myTextView不能包含空格.那我现在该怎么办?

android button textview

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