LayoutInflater的获取方式

1.LayoutInflater是什么?

通俗而讲,就是将xml中定义的布局找出来。

2.获取LayoutInflater的三种方式

  1. LayoutInflater inflater = getLayoutInflater();  //调用Activity的getLayoutInflater()

  2. LayoutInflater localinflater =  (LayoutInflater)context.getSystemService

                                                 (Context.LAYOUT_INFLATER_SERVICE);

  3. LayoutInflater inflater = LayoutInflater.from(context);

 

其实,这三种方式本质是相同的,从源码中可以看出

posted @   技术丶从积累开始  阅读(163)  评论(0编辑  收藏  举报
努力加载评论中...
点击右上角即可分享
微信分享提示