Wherever I look, FrameLayout
seems to be used as the FragmentContainer
.
Why is FrameLayout
always seen with Fragments
?
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How can I create this custom Bottom Navigation on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
You can basically use
RelativeLayout
orLinearLayout
it will still work,but the answer of your question is inFrameLayout
's documentation :You can read more about
FrameLayout
here : FrameLayout/Android DevelopersMain purpose of frame layout is to block the area required to fit the largest child view. If you use a Frame Layout as Fragment Container you can ensure that you always have the space available to accommodate the largest fragment layout.
In some cases you may need to have more than 1 fragment on screen simultaneously in that case you should prefer Relative or Linear Layout.
Everything is based on user requirements and customization needed.
It is not necessary to use FrameLayout at all.
For example in below code there is no layout taken , and fragment itself only contains single imageview .