我正在一个简单的应用程序,在屏幕的下半部分以纵向显示4x3方面的图像,并横向填充屏幕。纵向工作和320x240图像(通过网络加载)显示的大小。ImageView应该是全屏幕,但有错误的高度
旋转到横向,我在res/layout-land中使用单独的布局,省略了纵向布局的上半部分,并将ImageSwitcher全屏。有些半透明控制叠加图像,所以这里采用合并标签与ImageSwitcher和RadioGroup中的布局XML:
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android">
<ImageSwitcher
android:id="@+id/imageSwitcher"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="fill">
</ImageSwitcher>
<RadioGroup
android:id="@+id/radioGroup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|left"
android:orientation="horizontal">
...
</merge>
在ImageSwitcher的ImageViews是由一个独立的布局加载:
<?xml version="1.0" encoding="utf-8"?>
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="fill"
android:scaleType="fitXY"
android:adjustViewBounds="true"
android:contentDescription="@null">
</ImageView>
由于某些原因,图像视图不会填满屏幕。使用hierarchyviewer检查视图层次结构,我发现ImageSwitcher的尺寸为480x295(全屏减去顶部栏),但包含的ImageView的尺寸为480x240。
我已经挣扎了几个小时,摆弄了ImageSwitcher和ImageViews中的所有布局设置,但我无法让ImageView匹配其父级的480x295尺寸。任何帮助或洞察力的赞赏。
请问您可以显示代码吗? – CamHart 2016-11-09 06:36:33