Tag: 后退button

以编程方式将button添加到布局

我无法将button添加到我在XML中创build的布局中。 这是我想要达到的: //some class else { startActivity(new Intent(StatisticsScreen.this, ScreenTemperature.class)); } //// //ScreenTemperatureClass @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //this is where I call another class that //displays a nice graph setContentView(new GraphTemperature(getApplicationContext())); } 我想添加一个Button到这个新的屏幕,以便它会出现在图表下方。 我已经尝试创build一个LinearLayout视图,然后创build一个Button ,并将其添加到此视图,但我只是得到NullPointerException s .. 任何帮助,将不胜感激。 谢谢 编辑#1 以下是我尝试使用创build一个NullPointerException和'强制closures': Button buybutton; LinearLayout layout; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(new […]

如何防止多个表单提交在PHP中的多个点击

如何防止多个表单提交在PHP中的多个点击

jQuery – 单击button时增加计数器的值

我正在做一个系统,用户点击一个button,他们的分数增加。 有一个计数器,我想增加使用jQuery的价值(使页面不需要刷新),当button被点击。 我将如何去做这件事? <script type="text/javascript" src="http://code.jquery.com/jquery-1.4.3.min.js"></script> <script type="text/javascript"> $("#update").click(function() { $("#counter")++; } </script> #update是button,#counter是计数器。 在PHP中,++增加了一些东西的价值。 什么是jQuery的等价物? 另外,点击button时,还需要发送一个更新mysql数据库分值的请求,而不需要刷新页面。 有谁知道我会怎么做? 非常感谢 更新: 我已经尝试了下面的一些方法,但似乎没有任何工作! 我需要改变任何其他的工作? 我为它创build了一个testing页面: <html> <body> <script type="text/javascript" src="http://code.jquery.com/jquery-1.4.3.min.js"></script> <script type="text/javascript"> var count = 0; $("#update").click(function() { count++; $("#counter").html("My current count is: "+count); } </script> <button id="update" type="button">Button</button> <div id="counter">1</div> </body> </htlm>

处理android通知中的button

我在通知中添加了一个button 但是我不知道如何在被点击的时候调用一个函数。 我尝试了一种像https://code.google.com/p/languagepickerwidget/source/browse/trunk/trunk/src/org/gnvo/langpicker/LangPicker.java这样的方法,因为它也使用了RemoteViews对象,但是当我点击button。 这是我现在有: private void createNotification(){ String ns = Context.NOTIFICATION_SERVICE; NotificationManager notificationManager = (NotificationManager) getSystemService(ns); Notification notification = new Notification(R.drawable.ic_launcher, null, System.currentTimeMillis()); RemoteViews notificationView = new RemoteViews(getPackageName(), R.layout.notification_switch); //the intent that is started when the notification is clicked (works) Intent notificationIntent = new Intent(this, SettingsActivity.class); PendingIntent pendingNotificationIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0); notification.contentView = […]

点击特定button时如何跳过validation?

我在一个字段上有一个validation器的表单。 我有两个h:commandButton s:确定并取消。 当我input错误的数据,然后单击取消我得到一个validation消息。 当我点击取消时,我必须做什么validation器不运行?

如何自定义切换button?

我正在寻找自定义Switchbutton成为如下: 如何做到这一点?

Android:在一个循环中使用findViewById()和一个string

我正在制作一个Android应用程序,其中有一个由数百个button组成的视图,每个button都有一个特定的callback。 现在,我想使用循环来设置这些callback,而不必编写数百行代码(针对每个button)。 我的问题是:如何使用findViewById静态不必键入每个buttonID? 这是我想要做的: for(int i=0; i<some_value; i++) { for(int j=0; j<some_other_value; j++) { String buttonID = "btn" + i + "-" + j; buttons[i][j] = ((Button) findViewById(R.id.buttonID)); buttons[i][j].setOnClickListener(this); } } 提前致谢!

Android – button的边框

如何将边框添加到button? 是否有可能做到这一点,而不诉诸使用图像?

Android更改浮动操作button颜色

尝试了几个小时来更改Material的Floating Action Button颜色,但没有成功。 <android.support.design.widget.FloatingActionButton android:id="@+id/profile_edit_fab" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="end|bottom" android:layout_margin="16dp" android:clickable="true" android:src="@drawable/ic_mode_edit_white_24dp" /> 我试图添加 android:background="@color/mycolor" 或通过代码 FloatingActionButton fab = (FloatingActionButton) rootView.findViewById(R.id.profile_edit_fab); fab.setBackgroundColor(Color.parseColor("#mycolor")); 要么 fab.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#mycolor"))); 但以上都没有奏效。 我也尝试了“重复问题”中的解决scheme,但都没有工作,button保持绿色,也变成了方形。 我想要一个详细的答案,谢谢。 PS这也是很好的知道如何添加涟漪效应,也不明白这一点。

覆盖Android Backbutton行为仅适用于PhoneGap的第一页

我正在使用PhoneGap 1.5.0,jQuery 1.7.1和jQuery mobile 1.0.1,并试图覆盖Android中的后台button,如这里或这里所述 。 document.addEventListener("deviceready", onDeviceReady, false); // PhoneGap loaded function onDeviceReady() { console.log("PhoneGap Ready!"); // waiting for button document.addEventListener("backbutton", handleBackButton, false); } // handle the back button function handleBackButton() { console.log("Back Button Pressed!"); navigator.app.exitApp(); } 但它只适用于我的应用程序的第一页。 换到不同的页面后,button什么也不做。 该应用程序包含一个像这样的tabview: <body> <div data-role="page" id="pilotTab"> <div data-role="header"> <h1>Pilot</h1> </div> <div data-role="content" id="pilotContent"> content be here […]