当前位置: 代码迷 >> Android >> 小白求解这两句的意义
  详细解决方案

小白求解这两句的意义

热度:31   发布时间:2016-05-01 10:16:16.0
小白求解这两句的意思
String inflater = Context.LAYOUT_INFLATER_SERVICE;
LayoutInflater layoutInflater = (LayoutInflater) context.getSystemService(inflater);
LinearLayout linearLayout = null;





求解。。。

------解决方案--------------------
获取系统的填充器服务,主要用来渲染画面用的
------解决方案--------------------
这个一般就用来 动态添加布局什么的
------解决方案--------------------
等价于LayoutInflater layoutInflater = LayoutInflater.from(context);
你干脆这样写吧。 一句更好理解一些

上两楼都说得对动态的渲染一个view. 通过
View view = layInflater.inflate(R.layout.xx, null);来得到一个新的view
  相关解决方案