将 BuildConfig.FLAVOR 与 android 数据绑定一起使用

问题描述

我在布局文件中使用以下代码根据应用程序的风格类型更改两个不同的视图可见性。我还没有看到调试版本有任何问题,但我相信发布版本存在问题,因为我已经报告说这两个视图在测试版本中都是可见的。知道为什么会发生这种情况吗?

                    <Switch
                        android:id="@+id/configuration_main_network_switch"
                        style="@style/networkSelector"
                        android:visibility="@{BuildConfig.FLAVOR.equals(`xxxx`) ? View.GONE : View.VISIBLE}"
                        android:text="@{configurationMainNetworkSwitch.checked ? @string/network_configuration_main_wifi_enabled_button : @string/network_configuration_main_wifi_disabled_button}" />

                    <TextView
                        android:id="@+id/configuration_main_network_switch_gone"
                        style="@style/networkSelector"
                        android:visibility="@{BuildConfig.FLAVOR.equals(`xxxx`) ? View.VISIBLE : View.GONE}"
                        android:text="@string/network_configuration_main_wifi_enabled_button"/>

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)