1、当布局压要随时发生变化的时候,要用代码进行控制
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
ViewGroup homeGvItemLayout = (ViewGroup)inflater.inflate(R.layout.home_gv_item, null);
获取到layout对象之后,可以进行类似以下操作
TextView textView = (TextView)homeGvItemLayout.findViewById(R.id.home_gv_item_tv);