Android的,如果我用一个CustomAdapter如何访问我的自定义列表视图? [英] Android how to access views from my custom list if I use a CustomAdapter?

查看:128
本文介绍了Android的,如果我用一个CustomAdapter如何访问我的自定义列表视图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的申请,我有的ListView 这是由我的CustomAdapter(即ArrayAdapter)设置。 CustomAdapter已ViewHolder它实现这也在我的CustomList所有视图引用。
现在的问题是我怎么能访问的意见,我CustomList(如EditText上下文code)的类层次结构是像

In my application, I have ListView which is set by my CustomAdapter (i.e. ArrayAdapter). CustomAdapter has ViewHolder implemented in it which has references to all the views in my CustomList. Now my question is how can I access the views in my CustomList (like EditText in below code) as the class hierarchy is like

public class BaseActivityClass{
    ...
    class CustomAdapter{
        ...
        public class ViewHolder{
            EditText et;
            ...
            }
        }
    }

从我的活动BaseActivityClass?

from my activity BaseActivityClass?

推荐答案

您可以给你的查看一个唯一的ID( View.setId() )或标记( View.setTag() getView()法)和然后用 findViewById() findViewByTag()来使用它们。

You can give your View a unique id (View.setId()) or tag (View.setTag()) in your getView() method and then use findViewById() or findViewByTag() to use them

这篇关于Android的,如果我用一个CustomAdapter如何访问我的自定义列表视图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆