我想添加一个图像,而不是默认按钮.
我已经有了一个图像的CSS类,这会有用吗?
<asp:Button ID="..." CssClass=""/>
Run Code Online (Sandbox Code Playgroud)
我现在正在尝试,图像全都被碾碎了.也许这是一个CSS问题?
有时我的UI中有一个按钮,它很小,很难点击.到目前为止我的解决方案是在photoshop中的按钮周围添加透明边框.只是增加按钮上的填充不起作用,因为这也会拉伸图像.因为每次想要更改可点击表面时打开photoshop都有点大惊小怪,有没有办法以编程方式执行此操作?我已经尝试在按钮后面放置一个framelayout并使其可以点击,但是按钮不会改变触摸时的外观.当然我还可以在framelayout上添加一个ontouchlistener来改变按钮的外观,但是如果我有几个这样的按钮,它就会有一些代码.
干杯,
当我点击一个jquery ui按钮时,它仍会触发click事件回调.如何阻止该事件?我是否必须手动跟踪状态或者jquery ui为我处理这个问题?
我layout_marginLeft="30dip"在为按钮定义的样式中使用了属性.当我为每个按钮单独应用此样式时,左边距按我的意愿放置.
但后来我定义了一个主题,我将按钮样式分配给属性android:buttonStyle并将其应用到我的项目中.
但是,左边距属性将被忽略.知道我必须在这做什么吗?
style.xml如下:
<style name="btnstyle" parent="@android:style/Widget.Button">
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_marginLeft">30dip</item>
<item name="android:textColor">#FFFFFF</item>
</style>
<style name="appstyle" parent="android:Theme">
<item name="android:buttonStyle">@style/btnstyle</item>
</style>
Run Code Online (Sandbox Code Playgroud) 我在一个字段上有一个带验证器的表单.我有两个h:commandButtons:Ok和Cancel.当我输入错误的数据并单击取消时,我会收到验证消息.当我点击取消时,我必须做什么验证器不运行?
我有这个表格声明:
<form method="post" action="/web_services/buscar_vuelos?method=get">
<div id="addSegment_wrapper">
<button class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" id="addTr" style="display: inline;">
<span class="ui-button-text">Add Segment</span>
</button>
</div>
<input id="web_services_submit" class="ui-button ui-widget ui-state-default ui-corner-all ui-button- text-only" type="submit" value="Search" name="commit">
</form>
Run Code Online (Sandbox Code Playgroud)
而且,虽然我没有将"addSegment_wrapper"按钮指定为提交按钮,但每次单击它时,它都会调用表单操作.我只想将此按钮视为常规按钮.
我该怎么办?
谢谢
我是Android新手,很抱歉,这个问题很容易回答.我有两个按钮,一个减少按钮和一个增加按钮,在它们中间有一个显示值的TextView.
当我按下减少按钮时,当我按下增加按钮时TextView中的值减小并增加,没有问题,我得到了它的工作,但问题是只需单击一下,值就会增加/减少1.我想要实现的是,当我连续按下按钮(例如增加按钮)时,该值也会不断增加,并且只有在我释放增加按钮时才会停止.
那可能吗?如果是这样,您能否展示一些示例代码或如何实现它的参考?谢谢!
这是我的main.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="44dp"
android:gravity="center_horizontal" >
<Button android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:text="<" />
<TextView android:id="@+id/textView1"
android:layout_width="50dp"
android:layout_height="fill_parent"
android:layout_alignBottom="@+id/button1"
android:layout_toRightOf="@+id/button1"
android:gravity="center"
android:text="45" />
<Button android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toRightOf="@+id/textView1"
android:text=">" />
</RelativeLayout>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
这是我的Main.java
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
public class Main extends Activity {
private Button _decrease;
private Button _increase;
private TextView _value;
private static int _counter = …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用<input type="button">而不是仅使用按钮设置样式<button>.使用我的代码,按钮一直延伸到整个屏幕.我只是希望能够使它适合按钮中的文本.有任何想法吗?
请参阅jsFiddle示例或继续HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>WTF</title>
</head>
<style type="text/css">
.button {
color:#08233e;
font:2.4em Futura, ‘Century Gothic’, AppleGothic, sans-serif;
font-size:70%;
padding:14px;
background:url(overlay.png) repeat-x center #ffcc00;
background-color:rgba(255,204,0,1);
border:1px solid #ffcc00;
-moz-border-radius:10px;
-webkit-border-radius:10px;
border-radius:10px;
border-bottom:1px solid #9f9f9f;
-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,0.5);
-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,0.5);
box-shadow:inset 0 1px 0 rgba(255,255,255,0.5);
cursor:pointer;
}
.button:hover {
background-color:rgba(255,204,0,0.8);
}
</style>
<body>
<div class="button">
<input type="button" value="TELL ME MORE" onClick="document.location.reload(true)">
</div> …Run Code Online (Sandbox Code Playgroud) 我有以下HTML和jquery:
<html dir="ltr" lang="en">
<head>
</head>
<body>
<h2>Test disabling submit button for 1 minute...</h2>
<br/>
<p style="text-align:center">
<form id="yourFormId" name="yourFormId" method="post" action="#">
<input type="submit" class="submitBtn" value="I Accept"/>
</form>
</p>
<!--script to disable the submit button -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js">
</script>
<script type="text/javascript">
$(document).ready(function () {
$(".submitBtn").click(function () {
$(".submitBtn").attr("disabled", true);
return true;
});
});
</script>
<!--script ends here-->
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
按下时,提交按钮会在按下时被禁用.但是一旦按下它似乎没有执行提交.如果我删除了jquery以禁用该按钮,则该按钮会正常执行提交.
如何在执行提交后才禁用该按钮?上面的当前jquery似乎与提交操作冲突.
任何解决此问题的建议都会非常有帮助.
我试过这个代码..当模拟器启动时,它会在一行中显示三个单选按钮.但我需要一个按钮事件.即; 如果我点击按钮,它应该询问单选按钮的数量.那么如果我给出计数,它必须根据给定的计数显示单选按钮.例如,如果我将计数设为3,则必须在一行中显示三个单选按钮.非常感谢您的帮助.提前致谢.
public class MyActivity extends Activity {
/**
* Called when the activity is first created.
*/
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
for(int row=0; row < 1; row++)
{
LinearLayout ll = new LinearLayout(this);
ll.setOrientation(LinearLayout.HORIZONTAL);
for(int i = 1; i < 4; i++) {
RadioButton rdbtn = new RadioButton(this);
rdbtn.setId((row * 2) + i);
rdbtn.setText("Radio " + rdbtn.getId());
ll.addView(rdbtn);
}
((ViewGroup)findViewById(R.id.radiogroup)).addView(ll);
}
}
}
Run Code Online (Sandbox Code Playgroud)
这是xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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"
tools:context=".MainActivity" >
<RadioGroup …Run Code Online (Sandbox Code Playgroud) button ×10
android ×4
css ×2
submit ×2
asp.net ×1
coding-style ×1
count ×1
dynamic ×1
events ×1
html ×1
javascript ×1
jquery ×1
jquery-ui ×1
jsf ×1
jsf-2 ×1
margins ×1
radio-button ×1
themes ×1
validation ×1