Directly upload code and images.
Scenario 1:
[Html]
Copy codeThe Code is as follows: <? Xml version = "1.0" encoding = "UTF-8"?>
<LinearLayout xmlns: android = "http://schemas.android.com/apk/res/android"
Android: layout_width = "match_parent"
Android: layout_height = "match_parent"
Android: orientation = "horizontal">
<Fragment
Android: id = "@ + id/titles"
Android: layout_width = "0dip"
Android: layout_height = "match_parent"
Android: layout_weight = "1"
Class = "com. a2bgeek. fragmentdemo. TitlesFragment"/>
<FrameLayout
Android: id = "@ + id/details"
Android: layout_width = "0dip"
Android: layout_height = "match_parent"
Android: layout_weight = "2">
</FrameLayout>
</LinearLayout>
<? Xml version = "1.0" encoding = "UTF-8"?>
<LinearLayout xmlns: android = "http://schemas.android.com/apk/res/android"
Android: layout_width = "match_parent"
Android: layout_height = "match_parent"
Android: orientation = "horizontal">
<Fragment
Android: id = "@ + id/titles"
Android: layout_width = "0dip"
Android: layout_height = "match_parent"
Android: layout_weight = "1"
Class = "com. a2bgeek. fragmentdemo. TitlesFragment"/>
<FrameLayout
Android: id = "@ + id/details"
Android: layout_width = "0dip"
Android: layout_height = "match_parent"
Android: layout_weight = "2">
</FrameLayout>
</LinearLayout>
<? Xml version = "1.0" encoding = "UTF-8"?>
<LinearLayout xmlns: android = "http://schemas.android.com/apk/res/android"
Android: layout_width = "match_parent"
Android: layout_height = "match_parent"
Android: orientation = "horizontal">
<Fragment
Android: id = "@ + id/titles"
Android: layout_width = "0dip"
Android: layout_height = "match_parent"
Android: layout_weight = "1"
Class = "com. a2bgeek. fragmentdemo. TitlesFragment"/>
<FrameLayout
Android: id = "@ + id/details"
Android: layout_width = "0dip"
Android: layout_height = "match_parent"
Android: layout_weight = "2">
</FrameLayout>
</LinearLayout>
Case 2:
[Html]
Copy codeThe Code is as follows: <? Xml version = "1.0" encoding = "UTF-8"?>
<LinearLayout xmlns: android = "http://schemas.android.com/apk/res/android"
Android: layout_width = "match_parent"
Android: layout_height = "match_parent"
Android: orientation = "horizontal">
<Fragment
Android: id = "@ + id/titles"
Android: layout_width = "match_parent"
Android: layout_height = "match_parent"
Android: layout_weight = "1"
Class = "com. a2bgeek. fragmentdemo. TitlesFragment"/>
<FrameLayout
Android: id = "@ + id/details"
Android: layout_width = "match_parent"
Android: layout_height = "match_parent"
Android: layout_weight = "2">
</FrameLayout>
</LinearLayout>
<? Xml version = "1.0" encoding = "UTF-8"?>
<LinearLayout xmlns: android = "http://schemas.android.com/apk/res/android"
Android: layout_width = "match_parent"
Android: layout_height = "match_parent"
Android: orientation = "horizontal">
<Fragment
Android: id = "@ + id/titles"
Android: layout_width = "match_parent"
Android: layout_height = "match_parent"
Android: layout_weight = "1"
Class = "com. a2bgeek. fragmentdemo. TitlesFragment"/>
<FrameLayout
Android: id = "@ + id/details"
Android: layout_width = "match_parent"
Android: layout_height = "match_parent"
Android: layout_weight = "2">
</FrameLayout>
</LinearLayout>
Case 3:
Fragment occupies all of the content in wrap_content, which is not the same as the control.