回答編集履歴
4
修正
test
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
>②getLayoutInflater().inflate(int resource, null);
|
3
3
|
>この二つは一体何なんですか?
|
4
4
|
|
5
|
-
具体的なクラス
|
5
|
+
具体的なクラスの出自が書かれていないので推測前提ですが、
|
6
6
|
① はデータ バインディング ライブラリがレイアウト xml (activity_main.xml) から自動生成した ActivityMainBinding クラスの inflate メソッドです。
|
7
7
|
② は Activity の [getLayoutInflater](https://developer.android.com/reference/android/app/Activity#getLayoutInflater()) メソッドが返す LayoutInflater オブジェクトの inflate メソッドです。
|
8
8
|
従って、両 inflate メソッドはメソッド名が同じなだけで直接は**関係ありません**。
|
3
誤字
test
CHANGED
@@ -7,4 +7,4 @@
|
|
7
7
|
② は Activity の [getLayoutInflater](https://developer.android.com/reference/android/app/Activity#getLayoutInflater()) メソッドが返す LayoutInflater オブジェクトの inflate メソッドです。
|
8
8
|
従って、両 inflate メソッドはメソッド名が同じなだけで直接は**関係ありません**。
|
9
9
|
関係無いのでそのパラメータも同じでなければならないこともありません。
|
10
|
-
たまたま (?) 前者は ( 内部に既にリソース ID や ViewGroup があるため )LayoutInflater を必要とし、後者は ( 自身が Layout
|
10
|
+
たまたま (?) 前者は ( 内部に既にリソース ID や ViewGroup があるため )LayoutInflater を必要とし、後者は ( 自身が LayoutInflater のため ) リソース ID と ViewGroup が必要なだけです。
|
2
修正
test
CHANGED
@@ -7,4 +7,4 @@
|
|
7
7
|
② は Activity の [getLayoutInflater](https://developer.android.com/reference/android/app/Activity#getLayoutInflater()) メソッドが返す LayoutInflater オブジェクトの inflate メソッドです。
|
8
8
|
従って、両 inflate メソッドはメソッド名が同じなだけで直接は**関係ありません**。
|
9
9
|
関係無いのでそのパラメータも同じでなければならないこともありません。
|
10
|
-
たまたま(?)前者は LayoutInflater を必要とし、後者はリソース ID と ViewGroup が必要なだけです。
|
10
|
+
たまたま (?) 前者は ( 内部に既にリソース ID や ViewGroup があるため )LayoutInflater を必要とし、後者は ( 自身が LayoutFlater のため ) リソース ID と ViewGroup が必要なだけです。
|
1
修正
test
CHANGED
@@ -3,8 +3,8 @@
|
|
3
3
|
>この二つは一体何なんですか?
|
4
4
|
|
5
5
|
具体的なクラス・オブジェクト名が書かれていないので推測前提ですが、
|
6
|
-
① は
|
6
|
+
① はデータ バインディング ライブラリがレイアウト xml (activity_main.xml) から自動生成した ActivityMainBinding クラスの inflate メソッドです。
|
7
|
-
② は Activityの [getLayoutInflater](https://developer.android.com/reference/android/app/Activity#getLayoutInflater()) メソッドが返す LayoutInflater オブジェクトの inflate メソッドです。
|
7
|
+
② は Activity の [getLayoutInflater](https://developer.android.com/reference/android/app/Activity#getLayoutInflater()) メソッドが返す LayoutInflater オブジェクトの inflate メソッドです。
|
8
8
|
従って、両 inflate メソッドはメソッド名が同じなだけで直接は**関係ありません**。
|
9
9
|
関係無いのでそのパラメータも同じでなければならないこともありません。
|
10
10
|
たまたま(?)前者は LayoutInflater を必要とし、後者はリソース ID と ViewGroup が必要なだけです。
|