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

listview中的Android edittext失去了對調(diào)用notifydatacha

Android edittext in listview loses focus on calling notifydatachanged(listview中的Android edittext失去了對調(diào)用notifydatachanged的關(guān)注)
本文介紹了listview中的Android edittext失去了對調(diào)用notifydatachanged的關(guān)注的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

限時送ChatGPT賬號..

我在列表視圖中有一些編輯文本.我在edittext上有一個通用的focuslistener,它通過調(diào)用notifydatachanged更新數(shù)據(jù)模型的值以及當(dāng)焦點丟失時edittext的背景.問題是,如果其中一個編輯文本保持焦點,當(dāng)我觸摸下一個編輯文本時,它會暫時獲得焦點然后失去焦點.我懷疑這是由于 notifydatachanged 方法調(diào)用導(dǎo)致所有視圖被重繪,之后焦點丟失.有人對此問題有建議或解決方法嗎?謝謝.

I have a few edittext within a listview. i have a generic focuslistener on the edittext that updates the value of the data model and also the background of the edittext when focus is lost by calling notifydatachanged . The problem is that if one of the edittext is holding focus, when i touch the next edittext, it gains focus momentarily then loses focus. I suspect it is due to the notifydatachanged method call that is causing all views to be redrawn, after which the focus is lost. Does anyone have a suggestion or work around on the issue? Thanks.

推薦答案

這確實發(fā)生了,因為所有的視圖都被重繪了,所以代表任何過去被聚焦的行的編輯文本現(xiàn)在是一個完全不同的對象.在適配器中設(shè)置一個變量:int currentFocusedRow;

It is indeed happening because all the views are redrawn, so the edit text representing whatever row used to be focused is now a completely different object. Set a variable in your adapter: int currentlyFocusedRow;

在您的適配器的 getView 中:為每個編輯文本添加一個 onFocusChanged 偵聽器,當(dāng)該編輯文本獲得焦點時,設(shè)置 currentFocusedRow = 焦點編輯文本恰好位于的任何行.還將 currentFocusedRow 中的任何編輯文本設(shè)置為專注.

in getView for your adapter: Add an onFocusChanged listener to each edit text and when that edit text gains focus, set currentlyFocusedRow = whatever row the focused edit text happens to be in. Also set any edit text that is in the currentlyFocusedRow to be focused.

這篇關(guān)于listview中的Android edittext失去了對調(diào)用notifydatachanged的關(guān)注的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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成人| 色婷婷av一区二区三区软件 | 毛片久久久| 欧美aaaaaaaaaa | 一级黄色片免费在线观看 | 欧美日韩综合一区 | 美女在线观看国产 | www日本在线 | 欧美日韩高清 | 国产精品精品视频一区二区三区 | 成人福利影院 | 国产成人在线视频播放 | 欧美日韩国产在线观看 | 免费精品| 欧美久久大片 | 91九色视频在线 | 亚洲视频一区二区三区 | 成人欧美一区二区三区在线播放 | 91精品国产色综合久久不卡98 | 精品国产乱码久久久久久牛牛 | 国产成人免费视频网站高清观看视频 | 亚洲欧美日韩在线不卡 | 国产精品久久影院 | 国内精品一区二区三区 | 亚洲成人av一区二区 | 视频一区二区在线观看 | 91高清在线视频 | 国产成人精品一区二区三区四区 | 请别相信他免费喜剧电影在线观看 | 精品视频一区二区三区在线观看 | 免费h在线 | 国产色网站 | 婷婷免费视频 | 日本久草视频 | www.精品一区 | 欧美国产精品久久久 | 国产成人在线视频 |