獲得 LayoutInflater 實例的三種方式
1. LayoutInflater inflater = getLayoutInflater(); //調(diào)用Activity的getLayoutInflater()
2. LayoutInflater localinflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
3. LayoutInflater inflater = LayoutInflater.from(context);
這三種方式最終本質(zhì)是都是調(diào)用的Context.getSystemService()
其他待整理
不同Context對象創(chuàng)建的LayoutInflater對象也不同