splash页面到主页面转场黑屏

项目种遇到一个问题,splash页面到主页面转场黑屏

![image.png](https://upload-images.jianshu.io/upload_images/7037114-4a7b48b103115387.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools">

    <data>

        <variable
            name="viewModel"
            type="com.ttlock.roommaster.home.vm.HomeViewModel" />

        <import type="android.view.View" />

        <variable
            name="daySummary"
            type="com.ttlock.roommaster.home.model.DaySummaryObj" />

        <variable
            name="clickListener"
            type="android.view.View.OnClickListener" />
    </data>

    <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/radius_solid_white_bg">

        <com.hxd.custom.CenterIconTextView
            android:id="@+id/tv_key"
            style="@style/text_12dp_two_status"
            android:layout_width="0dp"
            android:layout_height="@dimen/menu_item_height"
            android:background="@drawable/click_transparent_layout_bg"
            android:gravity="center_horizontal"
            android:includeFontPadding="false"
            android:onClick="@{clickListener}"
            android:text="@string/user_keys"
            app:iconColor="@color/color_primary_selector"
            app:iconPadding="4dp"
            app:iconSize="32dp"
            app:iconTop="@string/ic_home_phone_unlock"
            app:layout_constraintLeft_toLeftOf="parent"
            app:layout_constraintRight_toLeftOf="@+id/tv_contract_management"
            app:layout_constraintTop_toTopOf="parent" />

        <com.hxd.custom.CenterIconTextView
            android:id="@+id/tv_contract_management"
            style="@style/text_12dp_two_status"
            android:layout_width="0dp"
            android:layout_height="@dimen/menu_item_height"
            android:background="@drawable/click_transparent_layout_bg"
            android:gravity="center_horizontal"
            android:includeFontPadding="false"
            android:onClick="@{clickListener}"
            android:text="@string/category_contract_management"
            app:iconColor="@color/color_primary_selector"
            app:iconPadding="4dp"
            app:iconSize="32dp"
            app:iconTop="@string/ic_home_contract"
            app:layout_constraintLeft_toRightOf="@id/tv_key"
            app:layout_constraintRight_toLeftOf="@+id/tv_renter"
            app:layout_constraintTop_toTopOf="@id/tv_key" />

        <com.hxd.custom.CenterIconTextView
            android:id="@+id/tv_renter"
            style="@style/text_12dp_two_status"
            android:layout_width="0dp"
            android:layout_height="@dimen/menu_item_height"
            android:background="@drawable/click_transparent_layout_bg"
            android:gravity="center_horizontal"
            android:includeFontPadding="false"
            android:onClick="@{clickListener}"
            android:text="@string/tenant"
            app:iconColor="@color/color_primary_selector"
            app:iconPadding="4dp"
            app:iconSize="32dp"
            app:iconTop="@string/ic_home_guest"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toEndOf="@id/tv_contract_management"
            app:layout_constraintTop_toTopOf="@id/tv_contract_management" />

        <com.hxd.custom.CenterIconTextView
            android:id="@+id/tv_employee_name"
            style="@style/text_12dp_two_status"
            android:layout_width="0dp"
            android:layout_height="@dimen/menu_item_height"
            android:background="@drawable/click_transparent_layout_bg"
            android:gravity="center_horizontal"
            android:includeFontPadding="false"
            android:onClick="@{clickListener}"
            android:text="@string/category_employee"
            app:iconColor="@color/color_primary_selector"
            app:iconPadding="4dp"
            app:iconSize="32dp"
            app:iconTop="@string/ic_home_staff"
            app:layout_constraintEnd_toStartOf="@id/tv_meter"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@id/tv_key" />

        <com.hxd.custom.CenterIconTextView
            android:id="@+id/tv_meter"
            style="@style/text_12dp_two_status"
            android:layout_width="0dp"
            android:layout_height="@dimen/menu_item_height"
            android:background="@drawable/click_transparent_layout_bg"
            android:gravity="center_horizontal"
            android:includeFontPadding="false"
            android:onClick="@{clickListener}"
            android:text="@string/tv_meter"
            app:iconColor="@color/color_primary_selector"
            app:iconPadding="4dp"
            app:iconSize="32dp"
            app:iconTop="@string/ic_home_lock"
            app:layout_constraintEnd_toStartOf="@+id/tv_fee"
            app:layout_constraintStart_toEndOf="@id/tv_employee_name"
            app:layout_constraintTop_toTopOf="@id/tv_employee_name" />

        <com.hxd.custom.CenterIconTextView
            android:id="@+id/tv_fee"
            style="@style/text_12dp_two_status"
            android:layout_width="0dp"
            android:layout_height="@dimen/menu_item_height"
            android:background="@drawable/click_transparent_layout_bg"
            android:gravity="center_horizontal"
            android:includeFontPadding="false"
            android:onClick="@{clickListener}"
            android:text="@string/module_fee"
            app:iconColor="@color/color_primary_selector"
            app:iconPadding="4dp"
            app:iconSize="32dp"
            app:iconTop="@string/ic_home_fee"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toEndOf="@id/tv_meter"
            app:layout_constraintTop_toTopOf="@id/tv_meter" />

        <com.hxd.custom.CenterIconTextView
            android:id="@+id/tv_rental"
            style="@style/text_12dp_two_status"
            android:layout_width="0dp"
            android:layout_height="@dimen/menu_item_height"
            android:background="@drawable/click_transparent_layout_bg"
            android:gravity="center_horizontal"
            android:includeFontPadding="false"
            android:onClick="@{clickListener}"
            android:text="@string/module_rental"
            app:iconColor="@color/color_primary_selector"
            app:iconPadding="4dp"
            app:iconSize="32dp"
            app:iconTop="@string/ic_home_rental"
            app:layout_constraintEnd_toStartOf="@id/tv_msg"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@id/tv_employee_name" />

        <View
            android:id="@+id/v_pop_rental"
            android:layout_width="21.5dp"
            android:layout_height="11dp"
            android:background="@drawable/pop_bg"
            android:visibility="@{daySummary.rentCollectNum==0 ? View.GONE:View.VISIBLE}"
            app:layout_constraintCircle="@id/tv_rental"
            app:layout_constraintCircleAngle="120"
            app:layout_constraintCircleRadius="12dp"
            app:layout_constraintEnd_toEndOf="@id/tv_rental"
            app:layout_constraintStart_toStartOf="@id/tv_rental"
            tools:ignore="MissingConstraints" />

        <TextView
            android:id="@+id/tv_pop_rental"
            style="@style/text_10dp_white"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:text="@{String.valueOf(daySummary.rentCollectNum)}"
            android:visibility="@{daySummary.rentCollectNum==0 ? View.GONE:View.VISIBLE}"
            app:layout_constraintCircle="@id/v_pop_rental"
            tools:ignore="MissingConstraints" />

        <com.hxd.custom.CenterIconTextView
            android:id="@+id/tv_msg"
            style="@style/text_12dp_black"
            android:layout_width="0dp"
            android:layout_height="@dimen/menu_item_height"
            android:background="@drawable/click_transparent_layout_bg"
            android:gravity="center_horizontal"
            android:includeFontPadding="false"
            android:onClick="@{clickListener}"
            android:text="@string/category_msg"
            app:iconColor="@color/color_primary_selector"
            app:iconPadding="4dp"
            app:iconSize="32dp"
            app:iconTop="@string/ic_home_message"
            app:layout_constraintEnd_toStartOf="@id/tv_repair"
            app:layout_constraintStart_toEndOf="@id/tv_rental"
            app:layout_constraintTop_toTopOf="@id/tv_rental" />

        <View
            android:id="@+id/v_pop_msg"
            android:layout_width="11dp"
            android:layout_height="11dp"
            android:background="@drawable/pop_red_point"
            android:visibility="@{daySummary.hasNewMessage==1 ? View.VISIBLE:View.GONE}"
            app:layout_constraintCircle="@id/tv_msg"
            app:layout_constraintCircleAngle="35"
            app:layout_constraintCircleRadius="24dp"
            tools:ignore="MissingConstraints" />

        <com.hxd.custom.CenterIconTextView
            android:id="@+id/tv_repair"
            style="@style/text_12dp_two_status"
            android:layout_width="0dp"
            android:layout_height="@dimen/menu_item_height"
            android:background="@drawable/click_transparent_layout_bg"
            android:gravity="center_horizontal"
            android:includeFontPadding="false"
            android:onClick="@{clickListener}"
            android:text="@string/repair"
            app:iconColor="@color/color_primary_selector"
            app:iconPadding="4dp"
            app:iconSize="32dp"
            app:iconTop="@string/ic_home_repair"

            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toEndOf="@id/tv_msg"
            app:layout_constraintTop_toTopOf="@id/tv_msg"

            />

        <View
            android:id="@+id/v_pop"
            android:layout_width="21.5dp"
            android:layout_height="11dp"
            android:background="@drawable/pop_bg"
            android:gravity="center"
            android:visibility="@{daySummary.repairNum==0 ? View.GONE:View.VISIBLE}"
            app:layout_constraintCircle="@id/tv_repair"
            app:layout_constraintCircleAngle="120"
            app:layout_constraintCircleRadius="12dp"
            tools:ignore="MissingConstraints" />

        <TextView
            android:id="@+id/tv_pop"
            style="@style/text_10dp_white"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@{String.valueOf(daySummary.repairNum)}"
            android:visibility="@{daySummary.repairNum==0 ? View.GONE:View.VISIBLE}"
            app:layout_constraintCircle="@id/v_pop"
            tools:ignore="MissingConstraints" />

        <com.hxd.custom.CenterIconTextView
            android:id="@+id/tv_hardware"
            style="@style/text_12dp_two_status"
            android:layout_width="0dp"
            android:layout_height="@dimen/menu_item_height"
            android:background="@drawable/click_transparent_layout_bg"
            android:gravity="center_horizontal"
            android:includeFontPadding="false"
            android:onClick="@{clickListener}"
            android:text="@string/hardware"
            android:visibility="@{viewModel.isShowCard==false? View.GONE : View.VISIBLE}"
            app:iconColor="@color/color_primary_selector"
            app:iconPadding="4dp"
            app:iconSize="32dp"
            app:iconTop="@string/ic_home_lock"
            app:layout_constraintEnd_toEndOf="@id/tv_key"
            app:layout_constraintHorizontal_weight="1"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@id/tv_rental" />
        <!--       "-->

        <!--       <com.hxd.custom.CenterIconTextView
                   android:id="@+id/tv_net_router"
                   style="@style/text_12dp_two_status"
                   android:layout_width="0dp"
                   android:layout_height="@dimen/menu_item_height"
                   android:background="@drawable/click_transparent_layout_bg"
                   android:gravity="center_horizontal"
                   android:includeFontPadding="false"
                   android:onClick="@{clickListener}"
                   android:text="@string/module_link"
                   android:visibility="invisible"
                   app:iconColor="@color/color_primary_selector"
                   app:iconPadding="4dp"
                   app:iconSize="32dp"
                   app:iconTop="@string/ic_home_gateway"
                   app:layout_constraintEnd_toStartOf="@id/tv_empty"
                   app:layout_constraintHorizontal_weight="1"
                   app:layout_constraintStart_toEndOf="@id/tv_hardware"
                   app:layout_constraintTop_toTopOf="@id/tv_hardware" />
       &lt;!&ndash;        android:visibility="@{viewModel.isShowCard==false? View.GONE : View.VISIBLE}"&ndash;&gt;

               <com.hxd.custom.CenterIconTextView
                   android:id="@+id/tv_empty"
                   style="@style/text_12dp_two_status"
                   android:layout_width="0dp"
                   android:layout_height="@dimen/menu_item_height"
                   android:background="@drawable/click_transparent_layout_bg"
                   android:gravity="center_horizontal"
                   android:includeFontPadding="false"
                   android:onClick="@{clickListener}"
                   android:text="@string/module_link"
                   android:visibility="invisible"
                   app:iconColor="@color/color_primary_selector"
                   app:iconPadding="4dp"
                   app:iconSize="32dp"
                   app:iconTop="@string/ic_home_gateway"
                   app:layout_constraintEnd_toEndOf="parent"
                   app:layout_constraintHorizontal_weight="1"
                   app:layout_constraintStart_toEndOf="@id/tv_net_router"
                   app:layout_constraintTop_toTopOf="@id/tv_hardware" />-->
        <!--        android:visibility="@{viewModel.isShowCard==false? View.GONE : View.VISIBLE}"-->

        <View
            android:id="@+id/expand_collapse_bg"
            android:layout_width="match_parent"
            android:layout_height="@dimen/list_menu_item_height"
            android:onClick="@{clickListener}"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@id/tv_hardware" />

        <TextView
            android:id="@+id/expand_text"
            android:layout_width="wrap_content"
            android:layout_height="@dimen/list_menu_item_height"
            android:text="@{viewModel.isShowCard==false? @string/expand : @string/collapse}"
            app:layout_constraintBottom_toBottomOf="@id/expand_collapse_bg"
            android:gravity="center_vertical"
            android:textColor="@color/colorPrimary"
            app:layout_constraintEnd_toStartOf="@id/expand_icon"
            app:layout_constraintHorizontal_chainStyle="packed"
            app:layout_constraintStart_toStartOf="@id/expand_collapse_bg"
            app:layout_constraintTop_toTopOf="@id/expand_collapse_bg" />
        <TextView
            android:id="@+id/expand_icon"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:gravity="center_vertical"
            android:text="@{viewModel.isShowCard==false? @string/ic_expand : @string/ic_collapse}"
            android:textColor="@color/colorPrimary"
            android:textSize="16sp"
            app:layout_constraintBottom_toBottomOf="@id/expand_collapse_bg"
            app:layout_constraintEnd_toEndOf="@id/expand_collapse_bg"
            app:layout_constraintHorizontal_chainStyle="packed"
            app:layout_constraintStart_toEndOf="@id/expand_text"
            app:layout_constraintTop_toTopOf="@id/expand_collapse_bg" />

    </androidx.constraintlayout.widget.ConstraintLayout>
</layout>

tv_hardware 布局种:
tv_rental
改成tv_key
tv_key

黑屏消失。

©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 202,802评论 5 476
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 85,109评论 2 379
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 149,683评论 0 335
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 54,458评论 1 273
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 63,452评论 5 364
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,505评论 1 281
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 37,901评论 3 395
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,550评论 0 256
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 40,763评论 1 296
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,556评论 2 319
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,629评论 1 329
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,330评论 4 318
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 38,898评论 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 29,897评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,140评论 1 259
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 42,807评论 2 349
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,339评论 2 342