标签: button

setVolumeControlStream()不起作用

我打电话setVolumeControlStream(AudioManager.STREAM_MUSIC);在onCreate()每一个我的三个活动中的应用方法,但他们没有工作.事实上,当我按下音量控制按钮时 - 根本没有任何反应.以下是文档中的引用:

无法保证硬件音量控制将始终更改此流的音量(例如,如果正在进行呼叫,则可以更改其流的音量).

我的应用程序正在做的就是在后台播放音乐并播放一些声音.它为什么不起作用?提前致谢.

controls android volume stream button

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

带按钮帮助器和缩略图助手的fancybox

如何使用按钮帮助器和缩略图助手添加fancybox?
是否可以将按钮(按钮助手)放在图像下面,以便我可以观看和选择我想要看到的内容?

按钮

$(document).ready(function() {
$(".fancybox-button").fancybox({
    prevEffect      : 'none',
    nextEffect      : 'none',
    closeBtn        : false,
    helpers     : { 
        title   : { type : 'inside' },
        buttons : {}
    }
});
Run Code Online (Sandbox Code Playgroud)

});

和缩略图代码

$(document).ready(function() {
$(".fancybox-thumb").fancybox({
    prevEffect  : 'none',
    nextEffect  : 'none',
    helpers : {
        title   : {
            type: 'outside'
        },
        overlay : {
            opacity : 0.8,
            css : {
                'background-color' : '#000'
            }
        },
        thumbs  : {
            width   : 50,
            height  : 50
        }
    }
});
Run Code Online (Sandbox Code Playgroud)

});


我有点新的JavaScript我无法让它工作.
我想要做的是将它们混合在一起并将按钮放在底部

PS我还可以使用fancybox缩略图助手来处理Youtube视频吗?

helper thumbnails button fancybox

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

触摸按钮上没有声音

如果我使用:

    final Button btnNught = (Button) findViewById(R.id.night);
    btnNught.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            // Perform action on click
            btnNught.setPressed(true);
        }
    });
Run Code Online (Sandbox Code Playgroud)

如果我点击按钮我会听点击声,但如果我使用:

    btnNught.setOnTouchListener(new OnTouchListener() {
        public boolean onTouch(View v, MotionEvent event) {
            if (btnNught.isPressed()) {
                btnNught.setPressed(false);
                return true;
            }
            else {
                btnNught.setPressed(true);
                return false;
            }
        }
    });
Run Code Online (Sandbox Code Playgroud)

我不接触任何声音.哪里弄错了?

编辑:我想创建像togglebutton这样的按钮,有两种状态:按下和非按下,当然有两种不同的颜色(正常 - 浅灰色非按下和绿色按下时).

在这种情况下(上图),当我触摸按钮时,我不听任何声音,但如果我使用onClick方法,我会听'点击'声音.当我使用onTouch方法时,如何获得"点击"或"触摸"声音?

audio android button touch

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

javascript按钮显示/隐藏文本已更改

我想使用java脚本显示和隐藏按钮.

我的问题是按钮应该在页面加载时隐藏,当我在文本框中更改文本时,应该显示按钮.

谢谢.....

javascript button toggle

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

更改按钮和textview的顺序会导致我的应用崩溃

我是Android开发的新手,我遇到了这个奇怪的问题.根据我的布局顺序,应用程序可以正常工作,或者只是在打开之前崩溃.

我的java代码:

package com.exmple.helloandroid;

import android.app.Activity;
import android.os.Bundle;
import android.widget.Button;
import android.widget.Toast;
import android.view.View;

public class HelloAndroid extends Activity{
/** Called when the activity is first created. */

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

            // According to logcat. Below is the error line
    Button myButton = (Button) findViewById(R.id.button1);
    myButton.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
                        Toast.makeText(HelloAndroid.this, "ImageButton clicked!", Toast.LENGTH_SHORT).show();
                }
    });
}
}
Run Code Online (Sandbox Code Playgroud)

和布局XML:

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

<Button
    android:id="@+id/button1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" …
Run Code Online (Sandbox Code Playgroud)

android button textview android-layout

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

Android按钮:显示黑色方块而不是img?

我有一个相当小但很奇怪的问题,我似乎无法修复.我正在尝试为我的按钮显示图像,它显示为黑色方块.我在此之前制作的按钮显示并且工作正常,但是此按钮(以及之后制作的其余按钮)显示为黑色方块.现在,如果我将其更改为ImageView而不是按钮,则显示正常.

以前有没有人遇到过这个问题?如果是这样,你是如何解决的?我仍然是编程的新手,我正在自学,所以我真的没有任何帮助,我一直在尝试修复它一段时间.:(

这是按钮/图像的xml.

<RelativeLayout
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">

        <Button
            android:id="@+id/pause"
            android:src="@drawable/pause"

            android:layout_width="29px"
            android:layout_height="29px"
            android:layout_alignParentRight="true"
            android:layout_alignParentTop="true"
            android:layout_marginTop="15dp"
            android:layout_marginRight="10dp">
        </Button>

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

如果您有任何其他问题,请询问,并感谢您查看我的问题!:)

android button

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

UILongPressGestureRecognizer具有不同的按钮

我有两个带"UILongPressGestureRecognizer"的按钮,为此,我这样做:

Fot按钮1:

-(IBAction)seleccionar46:(id)sender{
UILongPressGestureRecognizer *longpressGesture =[[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPressHandler:)];
longpressGesture.minimumPressDuration = 3;
[longpressGesture setDelegate:self];
[self.button1 addGestureRecognizer:longpressGesture];}
Run Code Online (Sandbox Code Playgroud)

对于按钮2:

    -(IBAction)seleccionar46:(id)sender{
UILongPressGestureRecognizer *longpressGesture =[[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPressHandler:)];
longpressGesture.minimumPressDuration = 3;
[longpressGesture setDelegate:self];
[self.button2 addGestureRecognizer:longpressGesture];}
Run Code Online (Sandbox Code Playgroud)

在"longpressGesture"中,我需要区分button1和button2,但我无法做到......

 - (void)longPressHandler:(UILongPressGestureRecognizer *)gestureRecognizer{//Here i need do the differentation}
Run Code Online (Sandbox Code Playgroud)

谢谢大家!

最好的祝福.

iphone xcode button

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

在buttonclick上启动新线程

我希望我的按钮启动一个新线程并销毁按钮所在的线程,点击它后,我该怎么做?

package inno.games;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.EditText;

public class Introscreen extends Activity {


Button proceed;

@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.intro);


proceed = (Button) findViewById(R.id.bProceed);



}
Run Code Online (Sandbox Code Playgroud)

android action button

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

如何通过按钮的onclick事件调用href?

我有以下a href用于打开jquery对话框,这工作正常.基本上,openDialog类附加了jquery对话框代码:

 <a class='openDialog' data-dialog-id='myEditDlg' data-dialog-autosize='false' data-dialog-alt='580' data-dialog-larg='740' data-dialog-title='test dialog' href='/mycontroller/EditDlg/myid'></a>
Run Code Online (Sandbox Code Playgroud)

现在,我想通过onclick一个按钮来调用它. 基本上,<a class='openDialog' href当我点击一个按钮时,我想要点击相同的行为.我该怎么做?**

html javascript jquery onclick button

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

如何使用CSS3制作关机按钮?

我试图使用类似于这张图片的CSS3制作关机按钮
http://static.desktopnexus.com/thumbnails/25080-bigthumbnail.jpg
到目前为止,我得到了这个.问题在于我无法使"半圆"看起来像图像中心的那个圆圈,不能将"半圆"和箱形阴影中心化为"半圆".
您有什么建议可以改善我想要做的事情吗?Thnx提前!

css button css3

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