如何在不损失图像边缘质量的情况下旋转ImageView

时间:2012-12-12 09:29:30

标签: java android image graphics android-canvas

enter image description here

I created two linearlayout with rotation and  then I placed the imageview in it ...
If the app loads and imageview displayed the edges of images in imageview look like this 
How can i get the imageview with proper edges.

以下是我的xml内容:

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="5dip"
        android:layout_marginTop="220dp"
        android:background="@drawable/mainscreen_imageframe"
        android:gravity="center"
        android:rotation="-8" >

        <ImageView
            android:id="@+id/imgBride"
            android:layout_width="150dip"
            android:layout_height="132dp"
            android:layout_marginBottom="15dip"
            android:adjustViewBounds="true"
            android:contentDescription="@string/app_name"
            android:scaleType="fitXY"
            android:background="@drawable/noimage" />
    </LinearLayout>

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="-47dip"
        android:layout_marginTop="210dp"
        android:background="@drawable/mainscreen_imageframe"
        android:gravity="center"
        android:rotation="9" >

        <ImageView
            android:id="@+id/imgGroom"
            android:layout_width="150dp"
            android:layout_height="132dp"
            android:layout_marginBottom="15dip"
            android:adjustViewBounds="true"
            android:contentDescription="@string/app_name"
            android:scaleType="fitXY"
            android:src="@drawable/noimage" />
    </LinearLayout>
</LinearLayout>

朋友们帮我解决这个问题...... 如何在旋转中获得合适的图像边缘

2 个答案:

答案 0 :(得分:0)

将此添加到xml中的图像视图

android:antialias="true"

答案 1 :(得分:0)

尝试使用9补丁工具制作9补丁图像。它会使图像伸缩。