Directly upload code and images.
Scenario 1:
[Html] <? 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]? 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>
<?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.