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

Android ScaleAnimation 無法縮放可點擊區域

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

問題描述

限時送ChatGPT賬號..

我的布局結構如下:

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

LinearLayout1
    LinearLayout2
        EditText

我正在使用 LayoutAnimationController 將 ScaleAnimation 應用到 LinearLayout1,以便層次結構中的所有視圖都按相同的量進行縮放.

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.

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

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.

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

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

推薦答案

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

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.

這是我對視圖的命中測試的實現.

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);
}

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

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

相關文檔推薦

Cut, copy, paste in android(在android中剪切、復制、粘貼)
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 位小數的數字)
Changing where cursor starts in an expanded EditText(更改光標在展開的 EditText 中的開始位置)
EditText, adjustPan, ScrollView issue in android(android中的EditText,adjustPan,ScrollView問題)
主站蜘蛛池模板: 自拍偷拍中文字幕 | 国产在线1 | 欧美日韩成人影院 | 免费v片 | 国产不卡在线观看 | 亚洲精品福利在线 | 丁香久久| 精品视频一区二区三区在线观看 | 中国一级大黄大片 | 琪琪午夜伦伦电影福利片 | 日韩在线观看网站 | 日韩视频一区在线观看 | 亚洲久久| 四虎成人av | 性色av一区| 日本欧美在线观看视频 | 久久久成人网 | 99国内精品久久久久久久 | 黄网站涩免费蜜桃网站 | 2020国产在线 | 国产精品美女www爽爽爽视频 | 日韩精品一区二区三区在线观看 | 久草99| 中文字幕亚洲在线 | 日韩精品一区二区三区第95 | 精品一区二区电影 | 国产精品不卡一区 | 成人精品久久日伦片大全免费 | 日韩三级在线 | 日韩一级在线 | 欧美一区视频在线 | 欧美一区二 | 精品国产乱码久久久久久a丨 | 久久日韩粉嫩一区二区三区 | 天天曰天天干 | 日韩伦理电影免费在线观看 | 中文字幕一区二区三区在线观看 | 亚洲在线一区二区 | 成人黄色av网址 | 欧美啪啪网站 | 国产精品美女一区二区 |