在Android的浏览holder类 [英] View holder Class in Android

查看:90
本文介绍了在Android的浏览holder类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个基本的问题。我正经历着由谷歌的Andr​​oid方面的官方视频。在这里面,他们用Viewholder类

This is a basic question. I was going through an official video by google regarding android. In it they used Viewholder class as

静态类Viewholder {     ImageView的形象;     TextView的文字; }

static class Viewholder{ ImageView image; Textview text; }

难道是正确的声明这个类的静态或视图架用作静态内部类。

Would it be right to declare this class as static or view holder is used as static inner class.

我觉得想,如果它的顶层类,那么编译器会同时使用static关键字与顶层类抛出错误。

I think suppose if its top level class then compiler will throw error while using static keyword with top level class.

推荐答案

使用静态仅当ViewHolder是一个内部类。

Use static only if your ViewHolder is an inner class.

这篇关于在Android的浏览holder类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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