首页 > 解决方案 > 旋转布局的背景图像

问题描述

我已经FrameLayout.设置了它的背景。现在我想在旋转更改时以编程方式旋转它onConfigurationChanged

我这样做了,但它改变了所有布局旋转

frameLayout.setRotation(180)

我不想放置不同的旋转图像。如何只改变背景图像的旋转,而不是整个布局?

标签: androidandroid-layout

解决方案


此代码仅用于旋转图像:

        android:rotation="90"
<ImageView android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:rotation="90"
        android:contentDescription="@string/image_divider"
        android:paddingBottom="8dp"
        android:paddingTop="4dp"
        android:scaleType="fitXY"
        android:src="@android:drawable/image" />

推荐阅读