
我自定义我的视图名称waterfallVIEw这里是代码:
public class WaterfallVIEw extends linearLayout {private listadapter m_Adapter;private OnClickListener onClickListener = null;private linearLayout m_line1;private linearLayout m_line2;private linearLayout m_line3;public WaterfallVIEw(Context context) { super(context); // Todo auto-generated constructor stub Initline();}public WaterfallVIEw(Context context,AttributeSet attrs) { super(context,attrs); Initline();}private voID Initline() { linearLayout.LayoutParams lp = new linearLayout.LayoutParams( linearLayout.LayoutParams.MATCH_PARENT,linearLayout.LayoutParams.MATCH_PARENT); lp.weight = 1; // line2 m_line1 = new linearLayout(this.getContext()); m_line1.setorIEntation(VERTICAL); m_line1.setLayoutParams(lp); // line2 m_line2 = new linearLayout(this.getContext()); m_line2.setorIEntation(VERTICAL); m_line2.setLayoutParams(lp); // line3 m_line3 = new linearLayout(this.getContext()); m_line3.setorIEntation(VERTICAL); m_line3.setLayoutParams(lp); addVIEw(m_line1); addVIEw(m_line2); addVIEw(m_line3);}public listadapter getAdapter() { return m_Adapter;}private voID BindLayout() { int count = m_Adapter.getCount(); for (int i = 0; i < count; i++) { VIEw v = m_Adapter.getVIEw(i,null,null); v.setonClickListener(this.onClickListener); if (i == 0 || i % 3 == 0) m_line1.addVIEw(v); if (i == 1 || i % 3 == 1) m_line2.addVIEw(v); if (i == 2 || i % 3 == 2) m_line3.addVIEw(v); } Log.v("countTAG","" + count);}private voID AddItem(){}public voID setAdapter(listadapter adapter) { this.m_Adapter = adapter; BindLayout();}public OnClickListener getonclickListner() { return onClickListener;}public voID setonclicklinstener(OnClickListener onClickListener) { this.onClickListener = onClickListener; }} 在BindLayout函数中有m_Adapter.getVIEw(i,null);
那么第二个param convertVIEw我想要使用RecycleBin的AbsListVIEw类
我怎么能这样做?
以上是内存溢出为你收集整理的android – 像PInterest这样的布局全部内容,希望文章能够帮你解决android – 像PInterest这样的布局所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)