久久久久久久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問題)
主站蜘蛛池模板: 亚洲欧美中文日韩在线 | 天天躁日日躁狠狠的躁天龙影院 | 国产精品视频网站 | 精品国产乱码久久久久久蜜臀 | av在线一区二区三区 | 久久久一二三 | 日日天天| 亚洲成人一区二区 | 四虎影院免费在线播放 | 夜夜爽99久久国产综合精品女不卡 | 亚洲 欧美 精品 | 中文字幕国产精品 | 婷婷毛片 | 波多野结衣一区二区 | 国产成人免费网站 | 一级黄色毛片子 | 一区二区三区国产精品 | 日韩在线播放网址 | 午夜久草 | www.青青草| 国产精品久久久久久高潮 | 中文字幕电影在线观看 | 波多野结衣精品 | 亚洲国产精品久久久久 | 夜夜骑首页| 一区二区三区在线免费看 | 福利视频1000| 亚洲成av人片在线观看无码 | 国产高潮好爽受不了了夜色 | 福利一区二区在线 | 欧美激情久久久 | 最新日韩欧美 | 成人在线小视频 | 99热在线观看精品 | a在线视频 | 欧美黄色片| a黄毛片 | 中文字幕一级毛片视频 | 国产精品观看 | 中文字幕亚洲欧美 | 亚洲第一成年免费网站 |