标签: button

如何在ExpandableListView中的组项中放置一个按钮?

我正在为Android开发一个应用程序.

我怎么能在ExpandableListView组中放一个按钮?

单击该按钮将显示一个对话框,而不是打开或关闭该组.单击按钮外部,组应该正常打开和关闭.

下图显示了我要插入按钮的位置.

http://img193.imageshack.us/img193/2060/expandablelistviewbutto.png

events android button expandablelistview

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

带按钮的Android Eclipse弹出消息

我想这样做,只需点击一下按钮,就会出现一条弹出消息.

现在,只要我打开应用程序,弹出窗口就会出现.

BTW我想要触发弹出窗口的按钮是main.xml中的about按钮

这是我的main.xml(带有布局的东西):

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/main"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="#3DE400"
    android:orientation="vertical" >

    <!-- background originally #d78a00 -->

    <TextView
        android:id="@+id/title"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="60dp"
        android:fontFamily="sans-serif-condensed"
        android:paddingLeft="10dp"
        android:text="Sample App"
        android:textColor="#FFF"
        android:textSize="60sp" />

    <TextView
        android:id="@+id/textView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:fontFamily="sans-serif-condensed"
        android:paddingLeft="10dp"
        android:text="@string/creator"
        android:textColor="#FFF"
        android:textSize="20dp" />

    <Button
        android:id="@+id/about"
        android:layout_width="123dp"
        android:layout_height="wrap_content"
        android:layout_marginTop="50dp"
        android:background="@android:color/transparent"
        android:fontFamily="sans-serif-condensed"
        android:gravity="left"
        android:paddingLeft="10dp"
        android:text="@string/about"
        android:textColor="#FFF"
        android:textSize="40dp"
        android:onClick="show" />

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

这是我的MainActivity.java:

package com.pranavsanghvi.sampleappv4;

import android.os.Bundle;
import android.app.Activity;
import android.app.AlertDialog;
import android.view.Menu;
import android.widget.Toast;
import android.content.DialogInterface;
import android.view.View;
import android.widget.Button;


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

java eclipse android popup button

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

如何在GVIM中显示标签关闭按钮?

请告诉我如何在GVIM的每个标签页上显示关闭按钮.

此外,如果我打开多个标签页关闭GVIM,是否可以设置警告?

vim tabs warnings button tabpage

8
推荐指数
2
解决办法
8443
查看次数

使用Javascript进行SVG旋转

我在HTML页面中创建了一个SVG图像,现在我想使用JavaScript按钮移动SVG形状.我的应用程序的JSFiddle在这里:http://jsfiddle.net/johndavies91/xwMYY/

已显示按钮,但单击按钮时不显示其功能.

功能代码如下;

function rotatex() {
document.getElementById("inner-arrow").setRotate(45,NativeCenterX,NativeCenterY)
}
function rotatey() {
document.getElementById("middle-arrow").setRotate(45,NativeCenterX,NativeCenterY)
}
function rotatez() {
document.getElementById("outer-arrow").setRotate(45,NativeCenterX,NativeCenterY)
}
Run Code Online (Sandbox Code Playgroud)

和他们相应的按钮;

<input id="button1" type="button" value="Rotate Inner Short Arrows 45*"
        onclick="rotatex()"/>
<input id="button1" type="button" value="Rotate Middle Short Arrows 45*"
        onclick="rotatey()"/>
<input id="button1" type="button" value="Rotate Outer Short Arrows 45*"
        onclick="rotatez()"/>
Run Code Online (Sandbox Code Playgroud)

我试图围绕形状的原点旋转它们.有人可以向我解释为什么这段代码不起作用.谢谢

html javascript css svg button

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

Android无法将FAB按钮锚定到BottomSheet

我正在尝试将FAB按钮附加到BottomSheet视图,就像谷歌地图一样.但是,我不能让它工作,

这是FAB按钮的代码:

 <android.support.design.widget.FloatingActionButton
    android:id="@+id/fab"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_margin="@dimen/fab_margin"
    android:src="@android:drawable/ic_dialog_email"
    app:layout_anchor="@+id/nestedscrollview" --> BottomSheet view ID
    app:layout_anchorGravity="bottom|end"
    app:elevation="4dp"
    />
Run Code Online (Sandbox Code Playgroud)

这是BottomSheet View的代码

<android.support.v4.widget.NestedScrollView
android:id="@+id/nestedscrollview"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_behavior="android.support.design.widget.BottomSheetBehavior"
tools:context="com.pub.uac.ui.location.LocationActivity"
android:background="@color/background_white_trasnparent"
 > 
... 
</...
Run Code Online (Sandbox Code Playgroud)

android button floating-action-button

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

SweetAlert2 - 绑定另一个事件取消按钮?

我正在使用最新版本的真棒SweetAlert2 jquery插件.

我有一个带2个按钮的简单SweetAlert.1按钮是确认按钮,另一个是取消按钮.我正在使用html选项向警报添加文本输入.当用户按下确认按钮时,执行AJAX呼叫并关闭警报.

现在我想使用取消按钮执行一些其他代码,而不是关闭警报的默认操作.(用户可以使用showCloseButton:true关闭警报).

所以简而言之:如何删除关闭处理程序并将自己的自定义处理程序添加到swal的取消按钮?

button sweetalert sweetalert2

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

Javascript:: 导出到文本文件

<!DOCTYPE html>
<html>

<head>
    <title>&nbsp;</title>
    <meta charset=utf-8>
</head>

<body>

    <table>
        <tr>
            <th>A</th>
            <th>B</th>
            <th>C</th>
        </tr>
        <tr>
            <td>Line #1</td>
            <td>SLTD</td>
            <td>32</td>
        </tr>
        <tr>
            <td>Line #2</td>
            <td>MKTD</td>
            <td>68</td>
        </tr>
        <tr>
            <td>Line #3</td>
            <td>LRTD</td>
            <td>55</td>
        </tr>
        <tr>
            <td>Line #4</td>
            <td>HAD</td>
            <td>47</td>
        </tr>
    </table>

    <button>Export to text file</button>

    <script>
        var theFirstChilds = document.querySelectorAll('table tr td:first-of-type'), text, i;

        text = "";

        for (i = 0; i < theFirstChilds.length; ++i) {
            text = text + theFirstChilds[i].innerText;
        }

        console.log(text);

        var button = document.getElementsByTagName("button")[0];

        button.addEventListener("click", function() {
            //alert("I …
Run Code Online (Sandbox Code Playgroud)

html javascript export onclick button

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

使用Angular启用/禁用按钮

我正在制作一个角度为4的网络应用程序,我想出了一个问题.它是以下内容:

我使用了一个名为currentLesson的属性.这个属性有一个从1到6的可变数字.在我的组件中,我有一个6课程的列表,每个课程都有自己的按钮来开始本课程.

在此列表中,只有当currentLesson具有课程编号的值时才能单击该按钮:

在以下情况下,第1课的按钮处于活动状态:currentLesson = 1

第2课的按钮在以下情况下处于活动状态:currentLesson = 2

等等

因此,如果currentLesson = 2,则应禁用第1,3,4,5和6课的按钮.

我有以下设置,但它似乎不起作用.在我的组件中我有:

export class ClassComponent implements OnInit {
  classes = [
{
  name: 'string',
  level: 'string',
  code: 'number',
  currentLesson: '1'
}]



checkCurrentLesson1 = function(classes) {
if (classes.currentLesson = 1) { 
 return true;
}
else {
 return false;
}
};

checkCurrentLesson2 = function(classes) {
if (classes.currentLesson = 2) {
 return true;
}
else {
 return false;
}
};
Run Code Online (Sandbox Code Playgroud)

我的html文件是这样的:

 <ul class="table lessonOverview">
    <li>
      <p>Lesson 1</p>
      <button [routerLink]="['/lesson1']" 
         [disabled]="!checkCurrentLesson1" class="primair"> …
Run Code Online (Sandbox Code Playgroud)

properties button typescript angular

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

在 SwiftUi 中禁用默认按钮单击动画

如何禁用 SwiftUI 和 Swift 5 中的默认按钮单击动画?我尝试添加.animation(.nil)到按钮,没有任何更改。

我知道您可以执行以下操作:

Button(action: {}) { Capsule() }
.buttonStyle(NoAnim())

struct NoAnim: ButtonStyle {
func makeBody(configuration: Self.Configuration) -> some View {
    configuration.label
}
Run Code Online (Sandbox Code Playgroud)

有人知道更聪明的方法吗?

animation default button disable swiftui

8
推荐指数
2
解决办法
2625
查看次数

在新窗口中打开视图的按钮 SwiftUI 5.3 for Mac OS X

我想要一个按钮来打开一个新窗口并在 SwiftUI for MacOS 中加载一个视图(用于应用程序的首选项),但我不确定正确的方法。

我尝试创建一个函数并从按钮操作调用它,但在关闭新窗口时应用程序崩溃:

线程 1:EXC_BAD_ACCESS(代码=1,地址=0x20)

这是我的功能:

func openPreferencesWindow() {
    var preferencesWindow: NSWindow!
    let preferencesView = PreferencesView()
    // Create the preferences window and set content
    preferencesWindow = NSWindow(
        contentRect: NSRect(x: 20, y: 20, width: 480, height: 300),
        styleMask: [.titled, .closable, .miniaturizable, .resizable, .fullSizeContentView],
        backing: .buffered,
        defer: false)
    preferencesWindow.center()
    preferencesWindow.setFrameAutosaveName("Preferences")
    preferencesWindow.contentView = NSHostingView(rootView: preferencesView)
    preferencesWindow.makeKeyAndOrderFront(nil)
}
Run Code Online (Sandbox Code Playgroud)

这是我调用它的按钮:

Button(action: {
    openPreferencesWindow()
}) {
    Text("Preferences").font(.largeTitle).foregroundColor(.primary)
}
Run Code Online (Sandbox Code Playgroud)

我觉得应该在 AppDelegate 中构建窗口,但我不确定我会如何调用它。

macos window button nswindow swiftui

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