-
Notifications
You must be signed in to change notification settings - Fork 535
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Android 启动背景图怎么适配?【已解决】 #715
Comments
在 android:windowBackground 中 使用 drawable 资源,通过bitmap 来加载图片资源,然后通过android:gravity="fill" 控制拉伸。避免直接去加载图片显示。 |
@yuminfeng 大兄弟, 我就是在android:windowBackground设置的bitmao来加载图片的, 按照你说的android:gravity="fill"设置成设个属性, 还是适配不了··· 什么情况 怎么上传不了图片啊!!!!!!!!!!!!!!!!!!!!! |
我都是这样处理的,你相关代码给看看。 |
我把背景图设置到SplashACtivity的 theme中了, <style name="Theme.Center" parent="AppTheme">
<item name="android:windowBackground">@drawable/bg_appbagkground</item>
<item name="android:windowNoTitle">true</item>
<item name="windowNoTitle">true</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">@null</item>
</style>
启动就是走的SplashActivity, 就这代码 没有别的了···· 另外 drawable/splash 的deawable下有三种类型的图片 |
试试 bitmap 放在layer-list 中 里面包裹一下 |
兄弟 能否把你的layer-list 文件发一下!! 还有你用了几张图呢? 分辨率各是多少的? |
我是用.9图把部分可以拉伸的像素拉伸,整体观感保持原有风格. |
兄弟 这两个方案你觉得哪个好呢? 能否给个简单的Demo??? |
像这样:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:gravity="fill">
<shape android:shape="rectangle">
<solid android:color="@color/white"/>
</shape>
</item>
<item android:gravity="center">
<bitmap
android:gravity="center"
android:src="@drawable/start_page"/>
</item>
</layer-list>
2018-07-17 9:15 GMT+08:00 薛 <notifications@github.com>:
… 兄弟 这两个方案你觉得哪个好呢? 能否给个简单的Demo???
我QQ 897902334
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#715 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AI-flbhbAQ844kM2rXxmFZhzt5Z1pZsDks5uHTqzgaJpZM4VK4Qq>
.
|
@zuyun 兄弟 你的 drawable/ 下的这个 start_page 有几幅图呢? |
我觉得碘酒图就能应付大部分启动页,当然了,我这个办法仅限本地写死的启动页 |
有人在吗? |
我想问个问题 |
就是,我刚入行,想学安砖开发,因该怎么下手呢? |
@kilo-swodh @zuyun 多谢两位兄弟指点!!! |
啊,为什么没有人指点我呢? |
@Fniy http://mars.apkbus.com/ 给你套安卓视频 入门经典! |
@DevXue 多谢一位兄弟指点!!! |
@DevXue 可惜我现在还是apk84的游客,看不到下载链接,不知道注册完会不会发现要vip才能下载 |
@kilo-swodh @zuyun 两位兄弟: 现在用的是:
但是这种方法 只解决了 全面屏手机, 然而在低分辨率的手机上效果就填充过度了··· |
@DevXue 这种图还不用碘酒图?让美工弄一下 |
@kilo-swodh 解决了,用的就是你说的 layer-list 。 我只保留了 xxhdpi 里头的 为 1080x1920的图! 谢谢你的回答! |
mark 一下,谢楼上各位 |
我按照这个方法,启动页还是没有适配 |
APP中启动时为了解决白屏一段时间的问题,加了个背景图上去, 可是在全面屏手机上拉伸很明显, 但是我也在不同的文件夹中放了对应分辨率的图片,可是还是适配不了部分手机, 请问这个背景图该怎么搞呢?
The text was updated successfully, but these errors were encountered: