【问题标题】:Android: ImageView scaleType, fitXy Doesn't WorkAndroid:ImageView scaleType,fitXy 不起作用
【发布时间】:2014-03-15 14:29:24
【问题描述】:

我在布局中使用了以下代码。我使用 scale type 属性并将其设置为“fitXy”,以拉伸 src 图像以填充 ImageView。但它不起作用,并且源图像没有被拉伸以填充完整的 imageview 大小。我是 android 的绝对初学者,请帮助我。

下面是我使用的代码。

    <FrameLayout
    android:layout_width="80dp"
    android:layout_height="80dp"
    android:layout_marginLeft="10dp"
    android:layout_marginTop="10dp" >

    <ImageView android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:src="@drawable/blue_calander"
        android:contentDescription="@string/cd_new_exam"
        android:scaleType="fitXY"/>
     <!-- some more code -->

</FrameLayout>

提前谢谢你。

【问题讨论】:

  • 你找到解决办法了吗?

标签: android android-layout android-imageview


【解决方案1】:

像这样更新你的布局

<FrameLayout
        android:layout_width="80dp"
        android:layout_height="80dp"
        android:background="#ff00" >

        <ImageView
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:contentDescription="@string/cd_new_exam"
            android:scaleType="fitXY"
            android:src="@drawable/ic_launcher" />
    </FrameLayout>

你已经给了保证金

    android:layout_marginLeft="10dp"
    android:layout_marginTop="10dp"

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-07-27
    • 2016-10-20
    • 1970-01-01
    • 1970-01-01
    • 2013-01-15
    • 1970-01-01
    相关资源
    最近更新 更多