【发布时间】:2014-03-21 05:53:01
【问题描述】:
我有一个比高更宽的水平图像。我希望图像在高度上完全填满显示器,我不在乎两侧是否被剪掉,因为它是图像的中心,很重要。
当 android 设备转向其一侧时,用户应该能够看到更多的图像,因为它是水平显示器上的水平图片。
我一直在使用 fill_parent 和 match_parent 填充内容并通过将它们导出到我的手机来一遍又一遍地测试所有这些内容。这一切都与虚拟设备和我的手机截然不同。
编辑:主要思想是当设备水平和垂直时覆盖整个显示器
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ImageButton
android:id="@+id/imageButton1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentTop="true"
android:contentDescription="@string/honktext"
android:onClick="amazinghonks"
android:scaleType="centerCrop"
android:src="@drawable/big_clown" />
<TextView
android:id="@+id/toptext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/imageButton1"
android:layout_alignRight="@+id/imageButton1"
android:layout_alignTop="@+id/imageButton1"
android:layout_margin="0dp"
android:gravity="center"
android:text="@string/toptext"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#33B5E5"
android:background="#CC303030"
/>
</RelativeLayout>
【问题讨论】:
标签: android android-layout android-imageview