Android去除折叠屏两边的黑边,默认全屏显示

1、在AndroidManifest.xml中设置resizeableActivity为true

sdk>=24resizeableActivity默认为true,小于24位false

可以设置在application中,影响app全局

可以设置在activity标签,影响当前activity

2、设置max_aspect与min_aspect

html 复制代码
<application
        android:resizeableActivity="true"
        android:name=".App"
        android:label="@string/app_name"
        android:icon="@mipmap/ic_launcher"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:theme="@style/AppTheme">

        <meta-data
            android:name="android.max_aspect"
            android:value="2.1"/>

        <meta-data android:name="android.min_aspect"
            android:value="1.0" />


        <activity
            android:resizeableActivity="true"
            android:configChanges="screenLayout|screenSize|smallestScreenSize"
            android:name=".MainActivity"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>

                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>

    </application>
相关推荐
启雀AI12 小时前
培训平台移动端离线学习方案设计与实现:视频缓存、断点续传与进度同步的工程实践
android·学习·缓存·音视频·企业lms
2601_9665635215 小时前
愤怒的小鸟单机版 去广告 安卓+PC端离线纯净版 益智耐玩小游戏 不需联网 老旧手机都可以玩 怀旧手机小游戏
android·智能手机
hunterandroid15 小时前
[Android 从零到一] Retrofit 请求取消与生命周期绑定:从 Call.cancel 到协程可取消设计
android
爱跑马的程序员15 小时前
安卓专有的通信子系统-Binder IPC
android·binder·ipc·安卓间通信机制
ue星空16 小时前
【安卓逆向】为什么用Frida?
android
小驰行动派16 小时前
Camx架构全景图:从V4L2到Pipeline的完整拆解
android·camera·android camera
hunterandroid17 小时前
[Android 从零到一] Custom View 触摸反馈与手势冲突解决
android
coderSong256818 小时前
Android | 四大组件之 BroadcastReceiver(广播接收器)
android
爱笑鱼21 小时前
Android 系统启动机制(二):init.rc 不是普通脚本,service、action 和 property 怎样驱动启动?
android
新鲜势力呀21 小时前
深入理解 Elliot CUDA 编程核心:PHP 实现 CUDA 并行计算思想与实践
android·开发语言·php