Android Dialog 显示不全的问题

前言:开发的时候发现一些运行到手机里的dialog显示不全,只显示一半左右

 问了下chatgpt发现没有任何头绪,于是开始自己慢慢分析

显示去掉了原有的dialog的style发现问题解决了,但在原有基础上如何解决呢?

先看看xml,发现设置了宽高都不起作用

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="@dimen/d2uc_dimen_1200"
        android:layout_height="@dimen/dialog_agreement_height"
    android:id="@+id/dialog_agreement_container"
    android:layout_marginTop="@dimen/d2uc_dimen_47"
    android:layout_marginStart="@dimen/d2uc_dimen_48"
    android:layout_marginBottom="@dimen/d2uc_dimen_48"
    android:background="@drawable/card_high_expand"
    android:padding="@dimen/card_high_expand_stroke"
    android:orientation="vertical">

....

</LinearLayout>

使用LayoutInspector查看发现其宽高都特别小

尝试把windows的宽度和高度设置为最大后发现问题解决了!!!!所以特此记录一下,这个问题花了我一二个小时折腾,macBookPro太老了原来越慢8G内存完全不够用!!!

getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);

相关推荐

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-01-23 08:54:03       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-01-23 08:54:03       100 阅读
  3. 在Django里面运行非项目文件

    2024-01-23 08:54:03       82 阅读
  4. Python语言-面向对象

    2024-01-23 08:54:03       91 阅读

热门阅读

  1. CF1893C Freedom of Choice 题解

    2024-01-23 08:54:03       48 阅读
  2. spring和springboot、springMVC有什么区别?

    2024-01-23 08:54:03       43 阅读
  3. 网安防御保护入门

    2024-01-23 08:54:03       50 阅读
  4. npm换源

    2024-01-23 08:54:03       52 阅读
  5. 【issue-halcon例程学习】fuzzy_measure_pin.hdev

    2024-01-23 08:54:03       50 阅读
  6. 【issue-halcon例程学习】measure_arc.hdev

    2024-01-23 08:54:03       47 阅读
  7. 流畅的Python(五)- 一等函数

    2024-01-23 08:54:03       46 阅读
  8. 使用flask_limiter限制接口访问速率的方法

    2024-01-23 08:54:03       54 阅读
  9. AcWing 1229.日期问题(枚举题,细节多)

    2024-01-23 08:54:03       54 阅读
  10. c# OpenTK 入门

    2024-01-23 08:54:03       52 阅读