Android 如何定期设置格子背景图像?
我才刚开始安卓编程,所以我真的是疯了! 我试图设置一个格子图案作为背景,我想防止在手机旋转时背景中的方块被洗牌,变成矩形!Android 如何定期设置格子背景图像?,android,Android,我才刚开始安卓编程,所以我真的是疯了! 我试图设置一个格子图案作为背景,我想防止在手机旋转时背景中的方块被洗牌,变成矩形! 你能想出解决我问题的办法吗!?最好用XML文件处理!这就是你想要的: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_wi
你能想出解决我问题的办法吗!?最好用XML文件处理!这就是你想要的:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView
android:id="@+id/imageView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:src="@drawable/background_image"
android:contentDescription="@string/text" />
</FrameLayout>
<!-- rest of your layout !-->
</RelativeLayout>
请确保您的背景图像足够大,足以填满大屏幕。到目前为止您尝试了什么?我刚刚在这些活动中禁用了旋转!最好最简单的方法。就像在windows中设置背景位置填充模式一样!谢谢你的回答!