1

我正在创建一个图像视图。但我的图像显示在中心,底部布局宽度也没有减少。这是我的代码:-

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <it.sephiroth.android.library.imagezoom.GalleryTouch
        android:id="@+id/image"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_above="@+id/textView1"
        android:layout_weight="1" />

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true"
        android:background="@drawable/bottom"
        android:text="                                     Thank you" />

</RelativeLayout>
4

2 回答 2

2

您应该使用 fill parent 来使用图像来填充整个屏幕,在这里我正在更改您的代码可能对您有用-

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
   android:layout_alignParentTop="true"
    android:layout_height="fill_parent"
     >

     <it.sephiroth.android.library.imagezoom.GalleryTouch
         android:id="@+id/image"
         android:layout_width="fill_parent"
         android:layout_height="fill_parent"
         android:layout_above="@+id/textView1"
          />

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:layout_alignParentBottom="true"
        android:background="@drawable/bottom"
        android:text=" THank you" />

    </RelativeLayout>
于 2012-10-29T09:43:39.800 回答
0

尝试使用 XML 文件中的属性android:scaleType="fitXY"for ImageView

于 2012-10-29T10:50:57.850 回答