ExpansionView2

来源:互联网 发布:单片机闭环控制 编辑:程序博客网 时间:2024/06/07 12:50


   private void initView()
   {
  this.itemView = View.inflate(this.context, R.layout.app_home_item, null);
  this.titleView = ((TextView)this.itemView.findViewById(R.id.home_item_title));
  this.itemView.findViewById(R.id.home_item_left_icon).setVisibility(View.GONE);//GONE不可见并且不占用空间
  this.left = ((ImageView)this.itemView.findViewById(R.id.home_item_left_icon));
  this.right = ((ImageView)this.itemView.findViewById(R.id.home_item_right_icon));
  this.childLayout = ((LinearLayout)this.itemView.findViewById(R.id.home_item_layout));
  this.headLayout = ((LinearLayout)this.itemView.findViewById(R.id.home_item_center_view));
   }

   public void baseHome(HomeLayout paramHomeLayout, final HomeActivity.OnExpandableListener paramOnExpandableListener){
   
    //功能模块ID
    final String FunctionId = paramHomeLayout.getFunctionId();
   
    //设置功能模块的名称:例如,“精品推荐”、“站内新闻”
       String Title = paramHomeLayout.getTitle();
       setTitle(Title);
      
       //获取当前模块的视图 itemView,等价于this.itemView = View.inflate(this.context, R.layout.app_home_item, null);
       final View localView = getItemView();

       //让ChildView不可见,当数据加载完毕之后再展开
       collapse();
      
       //根据isFold标志位判断该模块是否需要加载并显示数据
       if (paramHomeLayout.getisFold())
       {
        //调用onLoadData方法加载数据
        paramOnExpandableListener.onLoadData(localView, this.childView, FunctionId);
       
        //加载完毕后展开
        this.right.setImageResource(R.drawable.android_order_trace_info_less);
       }

原创粉丝点击