久久久久久久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問題)
主站蜘蛛池模板: 久久亚洲欧美日韩精品专区 | 亚洲a在线观看 | 罗宾被扒开腿做同人网站 | 97免费视频在线观看 | 国产精品国产精品国产专区不蜜 | 盗摄精品av一区二区三区 | 蜜桃视频麻豆 | 免费在线观看黄网站 | 亚洲欧美日韩精品久久亚洲区 | 精品久久久精品 | 欧美久久久久久久久中文字幕 | 午夜av一区二区 | 九九av | 久热伊人| 久久精品视频在线播放 | 国产精品毛片一区二区在线看 | 99精品视频免费在线观看 | 久久久久久国产精品 | 国产精品久久久久久久久久尿 | 日韩av在线一区二区 | 亚洲看片网站 | 欧美爱爱视频 | 成人高清网站 | 国产在线播放av | 神马久久久久久久久久 | 日韩亚洲视频在线 | 成人不卡 | 婷婷不卡 | 91视频在线观看 | 亚洲国产成人在线视频 | 91精品一区 | 日本成人福利 | 一级毛片黄片 | 成人伊人| 2020国产在线 | 免费视频二区 | 国产成人免费视频网站高清观看视频 | 日韩成人在线观看 | 91不卡| 日本一二三区高清 | 中文字幕亚洲一区二区三区 |