Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

一周安卓开发问题汇总(五) #139

Open
soapgu opened this issue Apr 26, 2022 · 0 comments
Open

一周安卓开发问题汇总(五) #139

soapgu opened this issue Apr 26, 2022 · 0 comments
Labels
problem problem or trouble 安卓 安卓

Comments

@soapgu
Copy link
Owner

soapgu commented Apr 26, 2022

  • 解决在xml中输入表达式使用&&的报错问题

虽然在xml的世界和代码的java文件是通的,也会出现一些水土不服的情况。
比如我在绑定表达式里增加&&,
结果ide直接报错了 "&" is causing error in android string resource xml
应该&是被其他表意了,xml解析需要转义解决,和字符串特殊字符转义一个套路
写成这样

&&

其实这也是一个有意思的哲学问题。
我怎么知道我是在做梦。“庄生梦蝶”,我怎么知道我是是否在真实的世界?
扯得远了。
实际上是有意义的。
疫情起见,很多条件只能一切从简了。
真机测试条件不具备。

模拟器其实还是一个不错的选择,现在Android Studio模拟机已经升级很完善了,除了比较吃内存磁盘。性能上还是能过得去的。但是总有一些差异,比如硬件灯控,root,部分组件没有x86架构等等。

差异是客观存在的,怎么让app正视这些差异,去兼容它,加强app的健壮性。

public abstract class OsFns {

    /***
     * 当前运行环境是否为模拟器
     * @return is Emulator
     */
    public static boolean isEmulator(){
        return Build.MODEL.contains("Android SDK built for x86");
    }
}

我这里判断条件简单了点,但是管用。先这样吧

@soapgu soapgu added 安卓 安卓 problem problem or trouble labels Apr 26, 2022
soapgu added a commit that referenced this issue Apr 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
problem problem or trouble 安卓 安卓
Projects
None yet
Development

No branches or pull requests

1 participant