如何使用android中的对话框片段使用对话框宽度制作图像宽度

时间:2014-05-09 06:42:02

标签: android android-layout android-fragments

有人能告诉我如何使用android中的对话框片段使用对话框宽度制作图像宽度吗?

我尝试使用下面的代码,但它在android 2.3中无效:

?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
     android:orientation="vertical"
    >
     <ImageView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
         android:src="@drawable/performance_nophoto" 
        android:id="@+id/imgPerformance"
        android:scaleType="fitXY"
        android:adjustViewBounds="true"
        /> 

</LinearLayout>

1 个答案:

答案 0 :(得分:0)

首先,如果你设置android:adjustViewBounds =&#34; true&#34;在imageview中,然后imageview的scaletype属性不起作用 所以,你必须使用android:adjustViewBounds =&#34; true&#34;或者android:scaleType =&#34; fitXY&#34;。

对于你的问题,只需删除android:adjustViewBounds =&#34; true&#34;来自imageview