qq_42780427 2021-03-23 17:04 采纳率: 0%
浏览 38

oppo reno3 pro 5g 应用没有铺满屏幕

如图左边所看到的,和适配不同,应用启动后左边会有空白,直接看到手机桌面

  • 写回答

1条回答 默认 最新

  • 码农阿豪@新空间代码工作室 Java领域优质创作者 2024-07-23 23:15
    关注
    让阿豪来帮你解答,本回答参考chatgpt3.5编写提供,如果还有疑问可以评论或留言
    问题描述:在应用启动后,左侧会出现空白,直接显示手机桌面。 解决方法:
    1. 检查应用启动时的布局文件是否正常,确保布局文件中没有设置左侧空白区域或者布局文件中左侧元素设置了固定宽度导致显示异常。
    2. 使用ConstraintLayout布局代替LinearLayout或RelativeLayout布局,ConstraintLayout可以更好地适配各种屏幕大小和密度,避免出现空白区域。
    3. 使用match_parent属性设置布局元素的宽度和高度,以适应不同屏幕大小。 示例代码:
    <android.support.constraint.ConstraintLayout 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:layout_width="match_parent"
        android:layout_height="match_parent">
        <Button
            android:id="@+id/button1"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:text="Button 1"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintEnd_toStartOf="@+id/button2"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintBottom_toBottomOf="parent"
            />
        <Button
            android:id="@+id/button2"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:text="Button 2"
            app:layout_constraintStart_toEndOf="@+id/button1"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintBottom_toBottomOf="parent"
            />
    </android.support.constraint.ConstraintLayout>
    

    通过以上方法修改应用的布局,可以避免出现左侧空白的情况,从而正常启动应用并显示内容。

    评论

报告相同问题?

悬赏问题

  • ¥20 wpf datagrid单元闪烁效果失灵
  • ¥15 券商软件上市公司信息获取问题
  • ¥100 ensp启动设备蓝屏,代码clock_watchdog_timeout
  • ¥15 Android studio AVD启动不了
  • ¥15 陆空双模式无人机怎么做
  • ¥15 想咨询点问题,与算法转换,负荷预测,数字孪生有关
  • ¥15 C#中的编译平台的区别影响
  • ¥15 软件供应链安全是跟可靠性有关还是跟安全性有关?
  • ¥15 电脑蓝屏logfilessrtsrttrail问题
  • ¥20 关于wordpress建站遇到的问题!(语言-php)(相关搜索:云服务器)