我正在为Android开发一个应用程序.
我怎么能在ExpandableListView组中放一个按钮?
单击该按钮将显示一个对话框,而不是打开或关闭该组.单击按钮外部,组应该正常打开和关闭.
下图显示了我要插入按钮的位置.
http://img193.imageshack.us/img193/2060/expandablelistviewbutto.png
我想这样做,只需点击一下按钮,就会出现一条弹出消息.
现在,只要我打开应用程序,弹出窗口就会出现.
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) 请告诉我如何在GVIM的每个标签页上显示关闭按钮.
此外,如果我打开多个标签页关闭GVIM,是否可以设置警告?
我在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)
我试图围绕形状的原点旋转它们.有人可以向我解释为什么这段代码不起作用.谢谢
我正在尝试将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) 我正在使用最新版本的真棒SweetAlert2 jquery插件.
我有一个带2个按钮的简单SweetAlert.1按钮是确认按钮,另一个是取消按钮.我正在使用html选项向警报添加文本输入.当用户按下确认按钮时,执行AJAX呼叫并关闭警报.
现在我想使用取消按钮执行一些其他代码,而不是关闭警报的默认操作.(用户可以使用showCloseButton:true关闭警报).
所以简而言之:如何删除关闭处理程序并将自己的自定义处理程序添加到swal的取消按钮?
<!DOCTYPE html>
<html>
<head>
<title> </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) 我正在制作一个角度为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) 如何禁用 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)
有人知道更聪明的方法吗?
我想要一个按钮来打开一个新窗口并在 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 中构建窗口,但我不确定我会如何调用它。
button ×10
android ×3
html ×2
javascript ×2
swiftui ×2
angular ×1
animation ×1
css ×1
default ×1
disable ×1
eclipse ×1
events ×1
export ×1
java ×1
macos ×1
nswindow ×1
onclick ×1
popup ×1
properties ×1
svg ×1
sweetalert ×1
sweetalert2 ×1
tabpage ×1
tabs ×1
typescript ×1
vim ×1
warnings ×1
window ×1