【发布时间】:2013-12-03 11:06:59
【问题描述】:
我有什么:
activity_comics.xml - 两个片段的布局容器:漫画列表 (view_comicses.xml) 和详细漫画视图
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:id="@+id/comics_fragment_container">
</FrameLayout>
view_comicses.xml - 带有交错列表视图的片段
<com.agimind.widget.huewu.pla.lib.MultiColumnListView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:pla="http://schemas.android.com/apk/res-auto"
android:id="@+id/multicollist"
android:layout_width="match_parent"
android:layout_height="match_parent"
pla:plaColumnNumber="2"
pla:plaLandscapeColumnNumber="3">
</com.agimind.widget.huewu.pla.lib.MultiColumnListView>
view_comics_detail.xml - 漫画详细视图片段
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/black">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/comics_image"
android:layout_centerInParent="true" />
</RelativeLayout>
在view_comicses.xml 和view_comics_detail.xml 片段添加到activity_comics.xml 之后,生成的布局应该是这样的:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:id="@+id/comics_fragment_container">
<com.agimind.widget.huewu.pla.lib.MultiColumnListView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:pla="http://schemas.android.com/apk/res-auto"
android:id="@+id/multicollist"
android:layout_width="match_parent"
android:layout_height="match_parent"
pla:plaColumnNumber="2"
pla:plaLandscapeColumnNumber="3">
</com.agimind.widget.huewu.pla.lib.MultiColumnListView>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/black">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/comics_image"
android:layout_centerInParent="true" />
</RelativeLayout>
</FrameLayout>
但由于某些原因,结果布局看起来像这样
RelativeLayout 的宽度和高度等于 match_parent,但在渲染时好像等于 wrap_content。为什么会这样?我尝试了 FrameLayout 和 RelativeLayout 的不同参数,但不起作用,任何帮助将不胜感激!
【问题讨论】:
标签: android android-layout android-fragments android-relativelayout android-framelayout