久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

Android ScaleAnimation 無法縮放可點擊區(qū)域

Android ScaleAnimation doesn#39;t scale clickable area(Android ScaleAnimation 無法縮放可點擊區(qū)域)
本文介紹了Android ScaleAnimation 無法縮放可點擊區(qū)域的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

限時送ChatGPT賬號..

我的布局結(jié)構(gòu)如下:

線性布局1
    線性布局2
        編輯文本

LinearLayout1
    LinearLayout2
        EditText

我正在使用 LayoutAnimationController 將 ScaleAnimation 應(yīng)用到 LinearLayout1,以便層次結(jié)構(gòu)中的所有視圖都按相同的量進行縮放.

I am applying a ScaleAnimation to LinearLayout1 using a LayoutAnimationController so that all of the views in the hierarchy are scaled by the same amount.

應(yīng)用 ScaleAnimation 后,所有視圖都正確縮放,但 EditText 不再響應(yīng)落在其最初占用空間之外的點擊.換句話說,EditText 的可點擊區(qū)域似乎沒有隨著視覺表示而縮放.

After applying the ScaleAnimation, the views are all scaled correctly, but the EditText no longer responds to clicks that fall outside the space it originally occupied. In other words, it appears that the clickable area for the EditText does not scale along with the visual representation.

在調(diào)用 ScaleAnimation 之前或之后是否有此問題的解決方案或我失蹤了?

Is there a solution to this problem or I am missing before or after calling the ScaleAnimation?

推薦答案

如果其他人正在尋找這個問題的答案,這里是我想出的解決方案.我在 LinearLayout1 中捕獲點擊事件,并使用 getHitRect 對視圖層次結(jié)構(gòu)進行手動遞歸命中測試,并將縮放因子應(yīng)用于接收到的尺寸.

In case anyone else is looking for the answer to this problem, here is the solution I came up with. I capture click events in LinearLayout1 and do a manual recursive hit test down the view hierarchy using getHitRect and applying the scaling factor to the dimensions received.

這是我對視圖的命中測試的實現(xiàn).

Here is my implementation of the hit test for a view.

public boolean scaledHitTest(float zoomScale, int x, int y) {
        Rect rect = new Rect();
        getHitRect(rect);
        rect.top = (int) (rect.top * zoomScale);
        rect.bottom = (int) (rect.bottom * zoomScale);
        rect.left = (int) (rect.left * zoomScale);
        rect.right = (int) (rect.right * zoomScale);

        return rect.contains(x, y);
}

這篇關(guān)于Android ScaleAnimation 無法縮放可點擊區(qū)域的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

Cut, copy, paste in android(在android中剪切、復(fù)制、粘貼)
android EditText blends into background(android EditText 融入背景)
Change Line Color of EditText - Android(更改 EditText 的線條顏色 - Android)
EditText showing numbers with 2 decimals at all times(EditText 始終顯示帶 2 位小數(shù)的數(shù)字)
Changing where cursor starts in an expanded EditText(更改光標(biāo)在展開的 EditText 中的開始位置)
EditText, adjustPan, ScrollView issue in android(android中的EditText,adjustPan,ScrollView問題)
主站蜘蛛池模板: 91热在线 | 97视频久久| 国产成人精品一区二区三区四区 | 香蕉一区二区 | 国产精品久久久久久久免费大片 | 99在线免费视频 | 国产欧美日韩一区二区三区 | 国产精品亚洲欧美日韩一区在线 | 婷婷丁香在线视频 | 成人不卡| 日日夜夜视频 | 成人午夜在线 | 在线视频一区二区三区 | 日韩国产黄色片 | 成人免费淫片aa视频免费 | 国产资源网 | 国产aaaaav久久久一区二区 | 精品av | wwwxxx日本在线观看 | 欧美 日韩 国产 成人 | 中文福利视频 | 日韩精品中文字幕一区二区三区 | 精品视频一区二区在线观看 | 国产成人免费观看 | 精品乱码一区二区 | 欧美综合一区二区 | 日韩一区二区三区精品 | 欧美一级在线免费 | 毛片大全 | 欧美激情亚洲激情 | 欧美色影院 | 国产电影一区二区在线观看 | 免费视频成人国产精品网站 | 成人国产精品久久久 | 欧美激情国产日韩精品一区18 | 亚洲精品成人网 | 国内精品久久久久久影视8 最新黄色在线观看 | 国产精品毛片无码 | 亚洲欧美高清 | 成人在线观看免费观看 | 久久伊 |