使用图层列表调整Android启动屏幕上的图像大小
如何调整屏幕大小,使其更集中于页面中心 初始屏幕.xml使用图层列表调整Android启动屏幕上的图像大小,android,Android,如何调整屏幕大小,使其更集中于页面中心 初始屏幕.xml <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" android:opacity="opaque"> <item android:drawable="@android:color/white"/>
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" android:opacity="opaque">
<item
android:drawable="@android:color/white"/>
<item>
<bitmap
android:gravity="center"
android:src="@drawable/fsa2"/>
</item>
</layer-list>
您可以使用ImageView并将可绘制资源设置为如下所示:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:background="@android:color/white"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="centerCrop"
android:adjustViewBounds="true"
android:layout_centerInParent="true"
android:layout_margin="32dp"
android:src="@drawable/fsa2"
/>
</RelativeLayout>
很抱歉,但是您将如何在可绘制文件中使用布局代码?@fernandotores我没有在可绘制文件中使用布局。我用的是布局而不是绘图。你的意思是像@layout/splashscreen那样用它作为窗口背景吗?