标签: button

自动调整故事板上受限按钮内的文本大小

我有一个通用应用程序,我使用故事板来约束一个按钮,以便从 iPhone 4 到 iPhone 6plus,大小将与设备的屏幕成比例。按钮的标题是数字“2”(屏幕上显示的只是可以按下的数字“2”)。出于某种原因,我无法弄清楚如何使用按钮大小自动调整字体大小,以便数字看起来与屏幕成比例。想法?

text button autoresize ios xcode6

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

如何基于按钮单击在新屏幕上的 webview 中打开 url

嗨,我已经在 stackoverflow 中尝试了所有可用的解决方案,但没有任何效果,单击按钮时应用程序停止。请帮帮我。

每当我单击按钮时,应用程序就会崩溃。我希望应用程序在单击按钮时在 webview 中打开 url。请帮助我,非常感谢任何帮助。

任何人都可以发布修改后的代码。

activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >



<Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/textView1"
        android:layout_alignParentTop="true"
        android:text="@string/button01" 
        android:onClick="onClick"/>
<Button
        android:id="@+id/button2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/textView1"
        android:layout_alignParentTop="true"
        android:text="@string/button02" 
        android:onClick="onClick"/>


</LinearLayout>   
------------------------------
screen3.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<WebView 
    android:id="@+id/webview" 
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" />
</LinearLayout>
-----------------------------------------------------
mainactivity.java

package com.example.webview;



import android.support.v7.app.ActionBarActivity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;

public class MainActivity extends …
Run Code Online (Sandbox Code Playgroud)

java android button android-webview

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

使用 Ruby on Rails 进行按钮重定向

我刚刚开始使用 ruby​​ on rails 和 web 应用程序。我刚刚用 ruby​​ 实现了一个数据库。我无法将主页中的按钮重定向到我希望它们访问的视图。我确信这是非常简单的事情,但我一直无法找到一种方法来做到这一点。

这是这个想法的链接。http://mauricegs.imgur.com/buttons

您按下显示“Productos”的按钮,它应该会将您发送到“Productos”视图。我不确定我应该在 productos 的参考中添加什么 谢谢

html ruby redirect ruby-on-rails button

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

如何使用 CSS 降低按钮的高度?

我是 CSS 新手。我有以下样式的标签按钮。如何降低按钮的高度?我尝试改变它,但它没有帮助。

我的代码:

.tag-btn {
    font-size: 10px;
    text-transform: uppercase;
    font-weight: bold;
    color: #fff;
    cursor: pointer;
    z-index: 5;
    position: relative;
    padding: 10px;
    line-height: 13px;
    margin: 0;
    height: 40px;
    -webkit-transition: all 0.2s ease-in-out;
    -moz-transition: all 0.2s ease-in-out;
    -o-transition: all 0.2s ease-in-out;
    -ms-transition: all 0.2s ease-in-out;
    transition: all 0.2s ease-in-out;
    background-color: #F08080;
    border: none;
    color: #fff;
    box-shadow: none;
} 
Run Code Online (Sandbox Code Playgroud)

有人可以帮我吗?谢谢。

html css button

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

onclick="confirm()" 取消按钮不起作用

我有 grid ,在那个 grid 中,对于特定的记录,我保持活动/非活动状态。这是对该状态的看法

在此处输入图片说明

当我单击活动按钮时,它会显示此警报消息。

在此处输入图片说明

但是当我单击取消按钮时,我无法停止将处于活动状态的操作。

这是此活动/非活动按钮的 html 代码片段

   @if (item.Status == true)
                       {
                           <button class="btn btn-xs active btn-primary" data-HEI_ID = "@item.HEI_ID" data-status = "true"  onclick="confirm_active()">Active</button>                       
                            <button class="btn btn-xs inactiveColor btn-default" data-HEI_ID = "@item.HEI_ID" data-status = "false"  onclick="confirm_inactive()">Inactive</button>

                       }

                       else
                       {
                           <button class="btn btn-xs btn-default" data-HEI_ID = "@item.HEI_ID" data-status = "true"  onclick="confirm_active()">Active</button>                       
                           <button class="btn btn-xs inactiveColor btn-primary active" data-HEI_ID = "@item.HEI_ID" data-status = "false"  onclick="confirm_inactive()">Inactive</button>

                           }
Run Code Online (Sandbox Code Playgroud)

这是警报消息的脚本部分

<script type="text/javascript">
function confirm_active() {
    var retVal = confirm("Are you sure you …
Run Code Online (Sandbox Code Playgroud)

html javascript jquery button asp.net-mvc-4

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

按钮单击 Javascript 后显示错误

单击按钮后,我会检查我的文本字段是否不为空。我的支票有效,但如果我显示我的消息,它会显示几秒钟。可能是我点击按钮的持续时间。这是我尝试过的一些代码。

<form>
    <div id="errorblock">
        <p id="errortext">Error.</p>
    </div>
    <!-- here are my input fields-->

    <button>Send</button>
</form>
Run Code Online (Sandbox Code Playgroud)

这是我在页面初始化后添加事件侦听器的地方:

document.getElementsByTagName("button")[0].addEventListener("click", function(){
    sendEmail();
});

function sendEmail() {

    //check if all fields are fill in. If not do this code;
    document.getElementById("errortext").innerHTML = "Fill in all the fields please.";

    var errorblock = document.getElementById("errorblock");       
    errorblock.style.visibility = "visible";
    errorblock.style.height = "46px";
}
Run Code Online (Sandbox Code Playgroud)

谁能帮我?谢谢

html javascript button buttonclick

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

在 Android Studio 中动态创建按钮时遇到问题

我是 Android 新手,不知道如何将按钮动态添加到预先存在的布局中。我将我从关于 SO 的另一个问题中找到的一些示例代码拼凑到一个 hello world 默认项目中。

onCreate 方法:

protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        Button myButton = new Button(this);
        myButton.setText("Add Me");

        RelativeLayout ll = (RelativeLayout)findViewById(R.id.main_layout);
        RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
        ll.addView(myButton, lp);

        setContentView(R.layout.activity_main);
    }
Run Code Online (Sandbox Code Playgroud)

布局:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
    android:id="@+id/main_layout"
    android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity">

    <TextView android:text="@string/hello_world" android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/textView" />

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="1"
        android:id="@+id/cat_1"
        android:layout_below="@+id/textView"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:layout_marginTop="26dp" />

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="2"
        android:id="@+id/cat_2"
        android:layout_alignBottom="@+id/cat_1"
        android:layout_alignParentRight="true"
        android:layout_alignParentEnd="true"
        android:layout_marginRight="65dp"
        android:layout_marginEnd="65dp" />

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

当我注释掉添加按钮部分时,该项目有效,所以我知道这就是问题所在。我会粘贴一些调试信息,但 logcat 的“调试”过滤器非常冗长,即使程序没有运行也会不断更新。当我在调试模式下运行它时,手机在出现“应用程序已停止工作”消息之前显示错误几分之一秒。

java android dynamic button android-relativelayout

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

Django - How to do an if statement if button is clicked

I want the user to click a button on my website, and when it is clicked I want i = i + 1. So far I have this code that doesn't work

 # On html file
<form method='get' action='#'>
    <input type="submit" value="Next" name="Next"/>
</form>

# In django views
    if request.GET.get('Name'):
        print('user clicked summary')
Run Code Online (Sandbox Code Playgroud)

html python django if-statement button

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

如何添加社交分享按钮?

目前我正在使用 AddThis 生成的社交分享按钮。但是我想在我的网站上使用相同的共享按钮而不添加其他网站的代码。

那么,如何开发同一个分享按钮呢?

社交分享按钮的屏幕截图

social currency sharing button

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

没有 CSS 的 Bootstrap 警报和关闭按钮功能

我想要 Bootstrap 警报和关闭按钮功能。我已经在我的页面头中包含了 JQuery 和 Bootstrap javascript 文件,但不想要其中的 CSS,因为它覆盖了大量的样式。

目前,我已将 Bootstrap 的这些部分添加到我自己的 css 中,以使警报和关闭按钮出现。

.alert {
    padding: 8px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    border-radius: 4px
}

.alert h4 {
    margin-top: 0;
    color: inherit
}

.alert .alert-link {
    font-weight: 700
}

.alert>p,
.alert>ul {
    margin-bottom: 0
}

.alert>p+p {
    margin-top: 5px
}

.alert-dismissable,
.alert-dismissible {
    padding-right: 35px
}

.alert-dismissable .close,
.alert-dismissible .close {
    position: relative;
    top: -2px;
    right: -21px;
    color: inherit
}

.alert-info {
    color: #31708f;
    background-color: #d9edf7;
    border-color: #bce8f1 …
Run Code Online (Sandbox Code Playgroud)

css alert button twitter-bootstrap

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