Android中的飞溅屏幕已拉伸
我添加了一个将要显示的飞溅屏幕,但总是将其伸展到边缘。如果屏幕不合格,我想夹紧它。
启动屏幕XML:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:gravity="fill|clip_horizontal"
android:src="@drawable/splash_screen"/>
</item>
</layer-list>
styles.xml
<resources>
<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="android:editTextBackground">@drawable/rn_edit_text_material</item>
</style>
<style name="SplashTheme" parent="AppTheme">
<item name="android:windowBackground">@drawable/launch_screen</item>
</style>
</resources>
我尝试了许多Android:Gravity
的组合,但是我没有找到合适的组合。另外,我在互联网上发现的所有组合都不适合我。 我正在在Google Pixel 3A上进行测试,该分辨率与任何可绘制的飞溅图像都不适合。
是否可以剪辑图像?
I added a splash screen that will be displayed, but it is always stretched to the edge. I want to clip it if the screen doesn't fit.
Launch Screen Xml:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:gravity="fill|clip_horizontal"
android:src="@drawable/splash_screen"/>
</item>
</layer-list>
styles.xml
<resources>
<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="android:editTextBackground">@drawable/rn_edit_text_material</item>
</style>
<style name="SplashTheme" parent="AppTheme">
<item name="android:windowBackground">@drawable/launch_screen</item>
</style>
</resources>
I tried many combinations of android:gravity
, but I didn't find the right one. Also, all combinations I found in the internet didn't work for me.
I am testing on a Google Pixel 3a which has a resolution that doesn't fit exact to any of the drawable splash images.
Is it possible to clip the image?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我找不到解决方案,但是我拍摄了没有背景的公正图像,用XML添加背景并以此为中心:
I didn't find a solution how to crop it, but I took the just image without background, add the background with xml and center it like this: