Inflator in Android Application Development

前端 未结 4 1902
不知归路
不知归路 2021-02-14 14:30

Can anybody please tell What Inflator is and how it is being used in an Android application?

I don\'t know the exact use of it and Why it is being used.

4条回答
  •  终归单人心
    2021-02-14 14:58

    Not quite sure what you mean, but if its related with inflating views, its used to load layout xml files into your application. e.g by

    View myWelcome = View.inflate(this, R.layout.welcome, null);
    

    Its easier and consider best practice to have you view definition inside layout xml files, instead of creating your views fully by code.

提交回复
热议问题