上述include代码部分就是两个引用.加上之后,是不是就能看到include文件里的内容显示出来了.
这里有一个问题,include里面的控件id是一样的,这怎么办呢.其实很简单,它们是被不同的include所包含,所以在使用findViewById的时候,从包含它的include里面取就行了.下面是代码
titleLayout = (LinearLayout)findViewById(R.id.vtitle); toptitleLayout = (LinearLayout)findViewById(R.id.vtop_title); //viewPager = (ViewPager)findViewById(R.id.viewpager); //点击按钮事件 txt_left_fc = (TextView)toptitleLayout.findViewById(R.id.txt_left_f); txt_left_fc.setOnClickListener(this); txt_right_fc = (TextView)toptitleLayout.findViewById(R.id.txt_right_f); txt_right_fc.setOnClickList
希望本文所述对大家Android程序设计有所帮助。
注:相关教程知识阅读请移步到Android开发频道。










