Inflator in Android Application Development

前端 未结 4 1600
自闭症患者
自闭症患者 2021-02-14 14:10

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:57

    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.

提交回复
热议问题