{"id":15110,"date":"2022-07-26T13:46:57","date_gmt":"2022-07-26T05:46:57","guid":{"rendered":"https:\/\/www.bookcard.net\/wordpress\/?p=15110"},"modified":"2022-07-26T13:46:57","modified_gmt":"2022-07-26T05:46:57","slug":"android_studio_touch_double_click","status":"publish","type":"post","link":"https:\/\/www.bookcard.net\/wordpress\/android_studio_touch_double_click\/","title":{"rendered":"Android Studio-Touch\u6a21\u62df\u300e\u55ae\u64ca\u300f\u300e\u96d9\u64ca\u300f"},"content":{"rendered":"<figure id=\"attachment_15111\" aria-describedby=\"caption-attachment-15111\" style=\"width: 1280px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/www.bookcard.net\/wordpress\/wp-content\/uploads\/2022\/07\/Android_Studio_Touch_Double_Click.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-15111\" src=\"https:\/\/www.bookcard.net\/wordpress\/wp-content\/uploads\/2022\/07\/Android_Studio_Touch_Double_Click.jpg\" alt=\"Android Studio-Touch\u6a21\u62df\u300e\u55ae\u64ca\u300f\u300e\u96d9\u64ca\u300f\" width=\"1280\" height=\"800\" srcset=\"https:\/\/www.bookcard.net\/wordpress\/wp-content\/uploads\/2022\/07\/Android_Studio_Touch_Double_Click.jpg 1280w, https:\/\/www.bookcard.net\/wordpress\/wp-content\/uploads\/2022\/07\/Android_Studio_Touch_Double_Click-300x188.jpg 300w, https:\/\/www.bookcard.net\/wordpress\/wp-content\/uploads\/2022\/07\/Android_Studio_Touch_Double_Click-768x480.jpg 768w\" sizes=\"auto, (max-width: 1280px) 100vw, 1280px\" \/><\/a><figcaption id=\"caption-attachment-15111\" class=\"wp-caption-text\">Android Studio-Touch\u6a21\u62df\u300e\u55ae\u64ca\u300f\u300e\u96d9\u64ca\u300f<\/figcaption><\/figure>\n<p><a href=\"https:\/\/www.bookcard.net\/wordpress\/android_studio_ndk_ontouch\/\">Android\u89e6\u6478Touch<\/a> \u624b\u6307\u89e6\u6478\u8367\u5c4f\u50b3\u905e\u300e\u9b06UP\u300f\u300e\u64b3DOWN\u300f\u300e\u62d6DRAGGED\u300f\u57fa\u790e\u4fe1\u606f, \u8981\u6a21\u62df\u300e\u55ae\u64ca\u300f\u300e\u96d9\u64ca\u300f, \u9996\u5148\u5b9a\u7fa9\u4fe1\u606f\u6307\u4ee4.<\/p>\n<table>\n<tbody>\n<tr>\n<td width=\"277\">#define TOUCH_CLICK\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a04<\/td>\n<td width=\"277\">\u55ae\u64ca<\/td>\n<\/tr>\n<tr>\n<td width=\"277\">#define TOUCH_DOUBLECLICK \u00a0\u00a05<\/td>\n<td width=\"277\">\u96d9\u64ca<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5b9a\u7fa9\u300e\u55ae\u64ca\u300f\u300e\u96d9\u64ca\u300f\u6642\u9593\u9593\u9694. \u7ea6\u64780.1\u79d2\u5373\u89e6\u767c\u55ae\u64ca,<\/p>\n<table>\n<tbody>\n<tr>\n<td width=\"321\">#define TOUCH_TIME_CLICK\u00a0 0.5f<\/td>\n<td width=\"232\">\u55ae\u64ca 500\u6beb\u79d2<\/td>\n<\/tr>\n<tr>\n<td width=\"321\">#define TOUCH_TIME_DOUBLECLICK\u00a0 0.5f<\/td>\n<td width=\"232\">\u96d9\u64ca 500\u6beb\u79d2<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5b9a\u7fa9\u519a\u57df\u8b8a\u91cf,\u8a18\u5f55\u300e\u64b3up\u300f\u300e\u55ae\u64caclick\u300f\u89e6\u767c\u6642\u9593.<\/p>\n<table>\n<tbody>\n<tr>\n<td width=\"277\">double touch_time_down;<\/td>\n<td width=\"277\">\u64b3-\u8fdb\u7a0b\u6642\u9418<\/td>\n<\/tr>\n<tr>\n<td width=\"277\">double touch_time_click;<\/td>\n<td width=\"277\">\u55ae\u64ca-\u8fdb\u7a0b\u6642\u9418<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u83b7\u5f97\u9032\u7a0b\u6642\u9418\u4fe1\u53f7<\/p>\n<table>\n<tbody>\n<tr>\n<td width=\"277\">clock_t clock(void);<\/td>\n<td width=\"277\">&nbsp;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u6bcf\u79d2\u6642\u9418\u8a08\u6642\u5355\u4f4d<\/p>\n<table>\n<tbody>\n<tr>\n<td width=\"293\">#define CLOCKS_PER_SEC 1000000<\/td>\n<td width=\"260\">\u6642\u9418\u5355\u4f4d<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u8a08\u9032\u7a0b\u6642\u9593,\u55ae\u4f4d\u300e\u79d2\u300f<\/p>\n<p>\u300e\u9032\u7a0b\u6642\u9593=\u6642\u9418\u4fe1\u53f7\/\u65f6\u9418\u5355\u4f4d\u300f<\/p>\n<table>\n<tbody>\n<tr>\n<td width=\"553\">double currTime = clock() \/ CLOCKS_PER_SEC ;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u7576\u63a5\u6536\u300e\u9b06UP\u300f\u6307\u4ee4.<\/p>\n<table>\n<tbody>\n<tr>\n<td width=\"553\">if(action == TOUCH_UP){\/\/\u9b06<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5224\u65b7\u4e24\u6b21\u55ae\u64ca\u5c0f\u65bc0.5\u79d2\u89e6\u767c\u96d9\u64ca<\/p>\n<table>\n<tbody>\n<tr>\n<td width=\"553\">if((currTime &#8211; touch_time_click) &lt; TOUCH_TIME_DOUBLECLICK )\u00a0 {<\/td>\n<\/tr>\n<tr>\n<td width=\"553\">touch-&gt;action[finger] = TOUCH_DOUBLECLICK; \/\/\u7d30\u904e500ms \u96d9\u64ca<\/td>\n<\/tr>\n<tr>\n<td width=\"553\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 touch_time_click = currTime; \u00a0\u00a0}<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5224\u65b7\u300e\u9b06UP\u300f\u300e\u64b3DOWN\u300f\u5c0f\u65bc0.5\u79d2\u89e6\u767c\u55ae\u64ca<\/p>\n<table>\n<tbody>\n<tr>\n<td width=\"553\">else if((currTime &#8211; touch_time_down) &lt; TOUCH_TIME_CLICK ) {\/\/ \u7d30\u904e500ms<\/td>\n<\/tr>\n<tr>\n<td width=\"553\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 touch-&gt;action[finger] = TOUCH_CLICK; \/\/\u55ae\u64ca<\/td>\n<\/tr>\n<tr>\n<td width=\"553\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 touch_time_click = currTime; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}}<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u8a18\u5f55\u300e\u64b3DOWN\u300f<\/p>\n<table>\n<tbody>\n<tr>\n<td width=\"553\">\u00a0\u00a0\u00a0 if(action == TOUCH_DOWN)<\/td>\n<\/tr>\n<tr>\n<td width=\"553\">touch_time_down = currTime;\/\/\u64b3-\u8fdb\u7a0b\u6642\u9593<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Android\u89e6\u6478Touch \u624b\u6307\u89e6\u6478\u8367\u5c4f\u50b3\u905e\u300e\u9b06UP\u300f\u300e\u64b3DOWN\u300f\u300e\u62d6DRAGGED\u300f\u57fa\u790e\u4fe1\u606f, \u8981\u6a21\u62df\u300e &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.bookcard.net\/wordpress\/android_studio_touch_double_click\/\" class=\"more-link\">\u7e7c\u7e8c\u95b1\u8b80 <span class=\"screen-reader-text\">Android Studio-Touch\u6a21\u62df\u300e\u55ae\u64ca\u300f\u300e\u96d9\u64ca\u300f<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[2],"class_list":["post-15110","post","type-post","status-publish","format-standard","hentry","category-android","tag-android","entry"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/posts\/15110","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/comments?post=15110"}],"version-history":[{"count":1,"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/posts\/15110\/revisions"}],"predecessor-version":[{"id":15112,"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/posts\/15110\/revisions\/15112"}],"wp:attachment":[{"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/media?parent=15110"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/categories?post=15110"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/tags?post=15110"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}