[英]“Layout Inflator ” and “Fragment Layout” in android
Plz解釋了android中“ Layout Inflator”和“ Fragment Layout”功能之間的區別,這是這兩種情況的最佳用例。
Layoutinflator和Frame布局是2個不同的概念。 Layoutinflator用於將視圖插入到一個視圖中,因為框架布局是可以同時容納單個項目的視圖組。
有關更多詳細信息, 請參見https://developer.android.com/reference/android/view/LayoutInflater.html https://developer.android.com/reference/android/widget/FrameLayout.html
**Layout Inflator:**
- Layout inflator is used to inflate UI(our desire layout xml). It is
similar to setContentView(view)
It can be replace setContentView.
It will be handy in fragments, since We are not able to use
setContentView in fragments.
We can use inflator in both activity and fragments. e.g. If you want
to customize dialog alert or pop up etc..
**FrameLayout**
- FrameLayout is designed to block out an area on the screen to display
a single item.
FrameLayout should be used to hold a single child view, because it
can be difficult to organize child views in a way that's scalable to
different screen sizes without the children overlapping each other.
FrameLayout is designed to display single item. It can be handy in
fragments , since it holds single item.
正如https://stackoverflow.com/users/6325805/writingforanroidoid所提到的,layoutinflater和framelayout是兩個不同的概念。
但是我想這家伙問的是fragmentlayout而不是framelayout。 據我所知,Android中沒有該名稱的實體。 但是,當您在活動中使用片段時,該片段必須定義其布局(活動只能包含該片段),這可能就是片段布局。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.