如何在Android中禁止背景图像旋转

时间:2016-07-05 10:45:31

标签: android android-activity background rotation

我有一项活动并且我想保持轮换,但我不想旋转背景图片。有人可以帮我这个吗?这是我的代码:

activity_main.xml中:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/background_test"
    tools:context=".Activities.MainActivity">

    ...

</LinearLayout>

提前感谢您的帮助。

1 个答案:

答案 0 :(得分:0)

如果没有编码,你就无法做到这一点。最好的方法是检查活动中的方向并相应地旋转位图。 “快速获胜”解决方案将是:

_runningJobs.Remove(job);

并覆盖资源文件夹中的轮播:AddJob中的<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:clipChildren="false"> <ImageView android:layout_width="match_parent" android:layout_height="match_parent" android:rotation="@integer/rotation" android:scaleType="centerCrop" android:src="@drawable/background"/> </FrameLayout> <integer name="rotation">90</integer>中的values-land