我有一个<TableLayout>
与两个<TableRow>
s。第一行包含两个按钮(工作正常),第二行包含一个<FrameLayout>
,其中包含一个<ImageView>
。我的问题是,第二个TableRow
(和FrameLayout
)不会出现,直到我加载到ImageView
图像。我希望FrameLayout
在任何时候都可见(以其背景色)。Android:tablerow消失?
我在<ImageView>
和<FrameLayout>
中使用了android:layout_width="match_parent"
和android:layout_height="match_parent"
,但它似乎没有帮助。
这里是布局的xml:
<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="5dp"
android:stretchColumns="1">
<TableRow>
<Button
android:id="@+id/buttonLoadPhoto"
android:text="Load..."
android:textSize="20sp"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
<Button
android:id="@+id/buttonPrintPhoto"
android:text="Print..."
android:textSize="20sp"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
</TableRow>
<TableRow
android:background="#FF4422">
<FrameLayout
android:id="@+id/frameLayoutPhoto"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#303030">
<ImageView
android:id="@+id/imageViewPhoto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="matrix">
</ImageView>
</FrameLayout>
</TableRow>
</TableLayout>
注1:我已经包括了违规<TableRow>
背景颜色只是这样我就可以缩小问题的TableRow
,而不是ImageView
(在TableRow
的背景颜色不显示)。注意2:这是一个Activity
的布局,加载到<TabHost>
的<FrameLayout>
,以防万一。
注3:我的目标是Android 2.2,并且我正在使用Xoom进行测试。
本质上,我想要<FrameLayout>
占用选项卡中的剩余空间。有没有其他方法可以做到这一点?
谢谢!
我还没有加入他们,因为它说,这是没有必要的。我只是尝试在第二个“”中添加'android:layout_height =“200dp”',但它没有做任何事情。 –
Ken
2011-06-17 00:56:49
您的框架布局是TableRow的一个子项,您确实在上面提供的代码中设置了宽度和高度,而不必在那里。 – TomHarrigan 2011-06-17 00:59:15
哦,我看到文档正在讨论TableRow的子项。删除它们没有区别 – Ken 2011-06-17 01:02:40