Android: listview 中的图像视图切割图像中的标记旋转

Android: tag rotation in imageview cutting image inside listview

我是 android 开发新手,我正在尝试在列表视图中旋转图像视图。我有以下自定义单元格 xml:

<RelativeLayout
    android:id="@+id/content"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:adjustViewBounds="true">

    <ImageView
        android:id="@+id/borderImageView"
        android:layout_width="@dimen/photoReceiverWidth"
        android:layout_height="@dimen/photoReceiverHeight"
        android:scaleType="fitXY"
        android:rotation="-10"/>
 </RelativeLayout>

当它显示时,它切断了图像的和平。视图未计算旋转的大小。

我不想创建新的位图,因为成本太高

android:adjustViewBounds="true"

这是一个图像视图 属性,因此请将其放在图像视图中而不是相对布局中。我不确定 adjustViewBounds 是否适用于固定大小的 ImageView。

您可以将宽度和高度更改为 wrap_content 并使用 maxHeightminHeight 属性 来定义一些额外的边界规则。

音阶类型可能也应该是 centerInside,但请尝试一下,看看哪个适合。