foodiestudio / error-prone Goto Github PK
View Code? Open in Web Editor NEW旨在记录一些容易出错的问题,并以 lint 的方式提示
License: MIT License
旨在记录一些容易出错的问题,并以 lint 的方式提示
License: MIT License
设置默认值的好处是,可以对大部分的页面布局不需要去声明颜色,减少一些工作量。
同时也是作为一种好的设计规范的一个组成。
如果想保留默认值的话,可以使用 ?android:colorBackground
这类的值
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true">
<vector android:width="22dp" android:height="22dp" android:viewportWidth="22" android:viewportHeight="22">
<path android:fillColor="@color/primary_button_bg_color" android:pathData="M11,11m-11,0a11,11 0,1 1,22 0a11,11 0,1 1,-22 0" android:strokeWidth="1" android:strokeColor="#00000000" />
<path android:fillColor="#FFFFFF" android:pathData="M9.7929,13.3284L15.0355,8.0858C15.4261,7.6953 16.0592,7.6953 16.4497,8.0858C16.8403,8.4763 16.8403,9.1095 16.4497,9.5L10.7929,15.1569C10.7427,15.2071 10.6885,15.2508 10.6313,15.2881C10.594,15.3453 10.5502,15.3995 10.5,15.4497C10.1095,15.8403 9.4763,15.8403 9.0858,15.4497L5.5503,11.9142C5.1597,11.5237 5.1597,10.8905 5.5503,10.5C5.9408,10.1095 6.5739,10.1095 6.9645,10.5L9.7929,13.3284Z" android:strokeWidth="1" android:strokeColor="#00000000" />
</vector>
</item>
<item android:state_checked="false">
<vector android:width="22dp" android:height="22dp" android:viewportWidth="22" android:viewportHeight="22">
<path android:fillColor="#00000000" android:pathData="M11,11m-10.5,0a10.5,10.5 0,1 1,21 0a10.5,10.5 0,1 1,-21 0" android:strokeWidth="1" android:strokeAlpha="0.1" android:strokeColor="#ff5800" />
</vector>
</item>
</selector>
但在低版本上不展示未勾选
会默认带上 nameValuePairs 这个名字
因为 JSONObject 本身已经序列化了,值都存放在 “nameValuePairs” 里,所以要避免使用 toJson(JSONObject)
确切的说是非用户点击同样触发了回调。
主要的场景会出现在recyclerview复用的时候:
switch.setChecked(??) // #A
swtich.switch.setOnCheckedChangeListener { buttonView, isChecked -> ...} // #B
#A 这一步会触发上次 #B 的回调。
为了避免这种情况,一般会在 setChecked 之前重置一下「setOnCheckedChangeListener(null)
」
除了这种方案,还有另外一种:
switch.setOnCheckedChangeListener { buttonView, isChecked ->
when {
buttonView.isPressed -> {
// 用户点击了触发,有个副作用的是,无障碍功能会受影响
}
else -> {
// 不是用户点击触发的
}
}
反复检查了项目里的代理,没问题啊,关了啊。为什么老是连接超时。
发现为啥走的是 127.0.0.1:1080 的代理
Android Studio 里 Proxy 是用于 Studio 升级相关的,Gradle 的代理是读取 gradle.properties 的,我确认过好几遍,工程里的这个文件没有设置过。
解决方案:
实际上,除了读取工程里的 gradle.properties 之外,还会读取 ~/.gradle/gradle.properties ,也就是这个文件里设置了代理,所以导致一直走的代理。
Is your feature request related to a problem? Please describe.
在完全按照官方文档接入的情况下,app认证依旧失败。在 Oneplus 8T (Android 12), Google pixel (Android 10) 都是一样的表现。
Describe the solution you'd like
这个属于网络问题,认证时需要访问一个谷歌的地址,这个在国内访问延迟很高,很可能会触发超时。
所以在国内的网络安装时会降级到 deep link。
Describe alternatives you've considered
可以考虑使用自定义 scheme 的方式来处理 app 的链接,这样一般能避免询问框的出现。
Additional context
App link 在不同版本上的表现会有所不同。
在 Android 12 上,一旦认证通过,这个链接将始终由这个 app 打开。而在之前的版本里是默认使用这个app打开,依旧允许用户修改这个选项。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.