08 2013 档案
摘要:一般adapter的做法会重写getView方法比如 1 @Override 2 public View getView(int position, View convertView, ViewGroup parent) { 3 if (convertView == null) { 4 convertView = LayoutInflater.from(context).inflate(R.layout.contentitem, null); 5 } 6 TextView title = (TextView) co...
阅读全文
摘要:自己定义一个view 1 2 3 8 9 15 16 21 22 28 29 34 35 40 41 42 48 对应的类 1 public class ContentItemView extends LinearLayout { 2 3 private TextView title; 4 private TextView author; 5 private TextView content; 6 private TextView otherInfo; 7 private ImageVie...
阅读全文
摘要:在应用中自定义一个view,需要获取这个view的布局,需要用到(LinearLayout) LayoutInflater.from(context).inflate(R.layout.contentitem, null);这个方法。一般的资料中的第二个参数会是一个null。通常情况下没有问题,但是如果我想给这个view设置一个对应的类,然后通过这个类来操作的话就会出问题。先看下面的例子 1 2 3 8 9 15 16 21 22 28 29 34 35 40 41 42 48 对应的类是 1 public class Conte...
阅读全文

浙公网安备 33010602011771号