我有一个活动,我想保持旋转,但是我不想旋转背景图像。有人可以帮我吗?这是我的代码:
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>
在此先感谢您的帮助。
如果没有编码,则无法执行此操作。最好的方法是检查活动的方向并相应地旋转位图。“快速获胜”的解决方案是这样的:
<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>
而在文件夹的ressource覆盖旋转:<integer name="rotation">90</integer>
在values-land
和<integer name="rotation">0</integer>
中values
。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句