在向Android按钮添加颜色后,它会失去其涟漪效果,使用户感觉有响应点击.我该如何解决?我已经搜索了很多解决方案,但我找不到一个不明确的明确解决方案.
<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=".ClockInOutFragment">
<AnalogClock
android:id="@+id/clock"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_toRightOf="@+id/date_and_time"/>
<RelativeLayout
android:id="@+id/date_and_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp">
<TextView
android:id="@+id/time_digits"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="12:10"
android:textSize="45sp"/>
<TextView
android:id="@+id/am_pm"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/time_digits"
android:layout_toRightOf="@+id/time_digits"
android:paddingLeft="3dp"
android:text="PM"
android:textSize="20sp"/>
<TextView
android:id="@+id/date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/time_digits"
android:text="Mon, July 11"
android:textSize="22sp"/>
</RelativeLayout>
<!--Clock in and out buttons-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:orientation="horizontal">
<Button
android:id="@+id/textView3"
android:layout_width="0dp"
android:layout_height="56dp"
android:layout_weight="1"
android:background="#4CAF50"
android:gravity="center"
android:text="Clock In"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#FFFFFF"/>
<!--Divider between the clock in and out button-->
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#B6B6B6"/>
<Button …Run Code Online (Sandbox Code Playgroud) 我的HTML:
<div id="x" onclick="clickHandler(event)">
<div id="button1">This turns green</div>
<div id="button2">This turns blue</div>
</div>
Run Code Online (Sandbox Code Playgroud)
首先,为什么我应该将"事件"传递给点击处理程序并且事件是某种系统关键字?此外,由于在容器div上标识了单击处理程序,我如何知道单击了哪个按钮?
我试图弄清楚我一直有这个奇怪的问题,根本原因是实时点击和触发之间.click()的区别.
我不会详细介绍问题,但基本上当你点击输入按钮时它工作正常(有一个onclick事件).但是,如果我.click()从其他地方打电话(而不是实际点击按钮),它就无法正常工作.
我的问题是 - 有没有办法真正复制按钮上的实际点击?
编辑
问题:我正在打开一个加载内联PDF的新窗口(aspx页面).如果我实际点击链接,窗口打开正常,PDF加载.如果我.click()打开窗口,系统会提示我下载PDF文件.我一直在阅读有关提示的Adobe Reader设置,浏览器设置和注册表设置 - 我知道这些可能是大局的因素,但是现在我关注为什么鼠标点击和.click之间的行为( )正在做任何不同的事情.
<div id="largeArea" v-on:click="do_X">
<button>Button</button>
</div>
Run Code Online (Sandbox Code Playgroud)
所以我在Vue中有这个问题,当我点击按钮时我不想触发"do_X",尽管它是largeArea的一部分.
我制作了一系列正方形
ctx.fillStyle = "rgb(0,0,0)";
for(x=0;x<=25;x++){
for(y=0;y<=25;y++){
ctx.fillRect(x, y, 20, 20);
}
}
Run Code Online (Sandbox Code Playgroud)
我想要一个正方形来点击时改变它的颜色.我怎样才能做到这一点?
我不太了解HTML5并需要一些帮助.谢谢.
我有这个页面,我正在创建,我似乎无法得到一个简单的jQuery点击工作.尝试悬停,尝试点击,尝试鼠标悬停等.没有运气.安装了jQuery 1.7.1.不确定为什么功能不起作用.任何人都有任何想法.链接和javascript遵循.提前致谢.
http://www.bigideaadv.com/adaptive/
$("#menu_show").click(function () {
alert('Works!');
});
Run Code Online (Sandbox Code Playgroud)
戴夫
是否可以在不将鼠标移动到该位置的情况下以编程方式单击另一个窗口中的位置,即使窗口不在顶部?我想将一种消息发送到另一个窗口以模拟鼠标单击某个位置.
我试图用PostMessage完成这个:
PostMessage(WindowHandle, 0x201, IntPtr.Zero, CreateLParam(300,300));
PostMessage(WindowHandle, 0x202, IntPtr.Zero, CreateLParam(300,300));
Run Code Online (Sandbox Code Playgroud)
我用这种方式创建了CreateLParam函数:
private static IntPtr CreateLParam(int LoWord, int HiWord)
{
return (IntPtr)((HiWord << 16) | (LoWord & 0xffff));
}
Run Code Online (Sandbox Code Playgroud)
问题是窗口被锁定在他的位置.我认为我的应用程序点击了(1,1)坐标.有人可以帮我解决这个问题吗?
编辑:这是PostMessage:
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("user32.dll")]
public static extern bool PostMessage(IntPtr WindowHandle, int Msg, IntPtr wParam, IntPtr lParam);
Run Code Online (Sandbox Code Playgroud)
0x201和0x202分别是WM_LBUTTONDOWN和WM_LBUTTONUP.
我在编程Android的新手,我尝试做一个小部件,可以从ISP获取有关我的帐户的一些数据.有很多未知的事情如何做,但我做了一些事情 - 我有一个配置活动的小部件,用户应该键入登录名和密码.窗口小部件将数据存储在SharedPerferences中,当需要更新窗口小部件时,我使用服务启动AsyncTask以从ISP获取帐户数据.现在我想通过点击小部件来开始一项活动.我已经尝试了我在这个网站上找到的所有建议,而且widget无法启动活动.我的小部件基于另一个小部件放在这里https://github.com/Arturus/MetrikaWidget.我不明白我应该通过点击我的小部件来改变什么以及在哪里开始活动.谢谢.
更新:我的更新功能,我建议我应该放置PendingIntent
@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds)
{
Log.d(TAG, "onUpdate");
for (int appWidgetId : appWidgetIds)
{
updateAppWidget(context, appWidgetManager, appWidgetId);
}
/* An updateAppWidget functions looks like as:
Intent intent = new Intent(context, UpdateWidgetService.class);
intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, appWidgetIds);
context.startService(intent);
*/
Intent intent = new Intent(context, DetailedStatActivity.class);
PendingIntent pendingIntent = PendingIntent.getService(context, 0, intent, 0);
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.layout);
views.setOnClickPendingIntent(R.id.layout, pendingIntent);
ComponentName componentName = new ComponentName(context.getPackageName(), WidgetProvider.class.getName());
appWidgetManager.updateAppWidget(componentName, views);
}
Run Code Online (Sandbox Code Playgroud) 我有这个代码:
<html>
<head>
<title>site</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#wlink a').click(function() {
$('.box:visible').fadeOut('fast', function() {
$('#' + (this.id).replace('link', '')).fadeIn('fast');
});
$('#wlink a').removeClass('selected');
$(this).addClass('selected');
});
$('#wlink div').click(function() {
var child = $(this).children();
child.click();
});
$('#linkbox1').addClass('selected');
$('#box1').fadeIn('fast');
});
</script>
</head>
<style>
a { outline: none; cursor: pointer; }
#wrapper { border:1px solid #cccccc; border:solid 1px #ddd; width:806px; height:255px; overflow: hidden; }
#wrapperBox { width:6000px; }
span.text { font-size:100px; color:#aaa; }
div.box { float:left; width:805px; height:255px; background:#efefef; display: none; }
#wlink …Run Code Online (Sandbox Code Playgroud) 我正在使用此代码显示本地通知,当通知出现时,点击通知想要启动ListActivity,但是在ListActiviy点击通知时不启动Google nexus设备,但在其他设备上此代码运行良好.
Intent notificationIntent = new Intent(context,
ListActivity.class);
notificationIntent.putExtra("clicked", "Notification Clicked");
notificationIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); // To open only one activity on launch.
PendingIntent pIntent = PendingIntent.getActivity(context, reqCode,
notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
NotificationManager nM = (NotificationManager) context
.getSystemService(Context.NOTIFICATION_SERVICE);
NotificationCompat.Builder notify = new NotificationCompat.Builder(
context);
notify.setContentIntent(pIntent);
notify.setSmallIcon(R.drawable.app_icon);
notify.setContentTitle("Hello World");
notify.setContentText("");
notify.setAutoCancel(true);
Uri alarmSound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
notify.setSound(alarmSound);
notify.setLights(Color.BLUE, 500, 1000);
nM.notify(reqCode, notify.build());
Run Code Online (Sandbox Code Playgroud)
未启动活动时添加logcat:
03-26 14:22:35.893: W/ActivityManager(515): Permission Denial: starting Intent { cmp=com.x.y/.music.ui.PlaybackActivity bnds=[42,101][636,186] (has extras) } from null (pid=-1, uid=10121) not exported from …Run Code Online (Sandbox Code Playgroud)