RoundImageView圆角控件
示例代码如下:
1 | import android.content.Context; |
在 attrs.xml 文件中定义控件的圆角dp值属性:
1 | <declare-styleable name="RoundImageView"> |
使用示例
1 | <com.xx.ui.widget.RoundImageView |
示例代码如下:
1 | import android.content.Context; |
在 attrs.xml 文件中定义控件的圆角dp值属性:
1 | <declare-styleable name="RoundImageView"> |
使用示例
1 | <com.xx.ui.widget.RoundImageView |
原文地址:https://www.cnblogs.com/baiqiantao/p/6890674.html
Installing Gradle: https://docs.gradle.org/current/userguide/installation.html
GRADLE_HOME:仅仅是为了可以在任意目录中执行 gradle 命令,没有特殊的意义GRADLE_USER_HOME:控制在命令行中执行 gradlew 命令时,gradle 下载的目录Gradle user home:控制在 IDEA 点击按钮执行各项 Task 等功能时,gradle 下载的目录User from gradle:控制在 IDEA 点击按钮执行各项 Task 等功能时,使用的 gradle 的版本设置环境变量 GRADLE_HOME 的目的,仅仅是为了方便在 Path 中指定 gradle 的位置。
GRADLE_HOME:D:_dev\gradle_GRADLE_HOME\gradle-6.7
Path:%GRADLE_HOME%\bin
将 gradle 添加到 Path 的目的是为了,可以在任意目录中执行 gradle 命令。
实际上,完全没必要设置环境变量 GRADLE_HOME,Do we really need GRADLE_HOME?
1 | gradle -v # 查看版本 |
其实 gradlew 只是一个 gradle 的封装(wrapper),gradlew = gradle wrapper,因为在项目根目录有 gradlew 和 gradlew.bat 这两个可执行文件,所以 能且仅能 在项目根目录中执行 gradlew 命令。
1 | D:\_dev\_code\as\Test> gradlew -v # 查看版本 |
这两个文件头部的注释也说明了他们的作用:
之所以添加这个 gradlew 脚本,是为了:
统一项目所使用的 gradle 版本,避免不同开发人员使用不同的 gradle 版本导致的兼容性问题
可以把 gradle-wrapper.properties 里面的下载 gradle 的地址切换到公司的公共空间上,以加快下载速度
1 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip |
设置环境变量 GRADLE_USER_HOME 的目的,是为了自定义下载 gradle 时的本地存储路径。
在命令行中执行 gradlew 命令(注意不是 gradle 命令)时,会将对应版本的 gradle 下载到此目录中。
下载 gradle 时,下载地址及版本由项目中的 /gradle/wrapper/gradle-wrapper.properties 决定。
1 | #Mon Nov 16 00:55:48 CST 2020 |
在 IDEA 的 File | Settings | Build, Execution, Deployment | Build Tools | Gradle 中,有一个 Gradle user home 的配置,其作用和环境变量 GRADLE_USER_HOME 类似,只不过该配置只是给 IDEA 使用的。譬如点击 gradle 窗口的各种 Task 按钮执行各项 Task 功能时。
注意:仅 IDEA 中的各种图形化操作会使用此配置,在 IDEA 的 Terminal 中执行 gradlew 命令时,使用的依旧是环境变量 GRADLE_USER_HOME。
在 IDEA 的 File | Settings | Build, Execution, Deployment | Build Tools | Gradle 中,有一个 User from gradle 的配置,它也是仅提供给 IDEA 使用的(对 gradlew 无效)。
其作用是,指定当前工程中 IDEA 所使用的 gradle 版本:
当勾选 gradle-wrapper.properties 时,使用 gradle-wrapper.properties 中指定的 gradle 版本。
为了防止和在 Terminal 中执行 gradlew 命令时使用的 gradle 版本不同,建议勾选此配置(也是默认配置)。
当勾选 Specified location 时,使用指定目录下的 gradle 版本。
如果 gradle 下载很慢,就可以勾选此配置,以便使用指定本地下载好的 gradle 版本。
不管在 IDEA 中怎么配置,在 Terminal 中执行 gradlew 命令时,所使用的 gradle 版本都是由
gradle-wrapper.properties决定的,并且下载路径也都是由环境变量GRADLE_USER_HOME决定的。
这里的 JDK 指的是执行 Gradle 命令依赖的 JDK,并非 AndroidStudio 工程依赖的 JDK。
通过 File | Settings | Build, Execution, Deployment | Build Tools | Gradle 设置的 JDK,是在运行 IDEA 图形化按钮时使用的。
通过 gradle.properties 设置的 JDK,是在 Terminal 中执行 gradlew 命令时使用的。
1 | # MacOS的路径写法 |
注意:AGP 从 7.0.0-alpha02 版本起,需要使用 Java 11
1 | val intent = Intent() |
警告:爱加密加固之后的包,会把这个异常给吃掉,导致无法跳转,也无反应。
这种方式需要处理手机中不存在指定浏览器的情况
1 | try { |
由于华为鸿蒙系统已经没有Android默认的浏览器,所以此处必须要有异常处理,或者提前处理手机中不存在指定浏览器的情况。
市场上常用浏览器的包名和类名@20220630
1 | 华为: "com.huawei.browser/com.huawei.browser.BrowserMainActivity" |
根据滑动位置动态改变背景透明度,直接上代码:
1 | binding.recyclerView.addOnScrollListener(object : RecyclerView.OnScrollListener() { |
https://developer.umeng.com/docs
qqzone_id_value 配置跟当前应用对应不上,PlatformConfig.setQQZone(qqzone_id_value, qqzone_secret_id_value)
https://support.atlassian.com/bitbucket-cloud/docs/set-up-an-ssh-key/
Use this section to create a default identity and SSH key when you’re using Git on Windows. By default, the system adds keys for all identities to the /Users/<username>/.ssh directory.
From the command line, enter ssh-keygen.
ssh-keygen -t rsa -b 4096 -C "email"
List the contents of .ssh to view the key files.
1 | dir .ssh |
If you don’t want to type your password each time you use the key, you’ll need to add it to the ssh-agent.
1 | eval $(ssh-agent) |

Open your .ssh/id_rsa.pub file and copy its contents.
From Bitbucket, Paste the copied public key into the SSH Key field. Click Save.
Return to the command line and verify your configuration and username by entering the following command:
1 | ssh -T git@bitbucket.org |
If you used a non-default file path for your GitLab SSH key pair,
you must configure your SSH client to find your GitLab SSH private key
for connections to your GitLab server (perhaps gitlab.com).
For OpenSSH clients this is configured in the ~/.ssh/config file.
Below are two example host configurations using their own key:
1 | GitLab.com server |
如果使用rsa加密方式,出现秘钥无效,依旧提示输入用户名密码验证,请通过ed25519加密方式,生成ssh秘钥。
ssh-keygen -t ed25519 -C "email" -b 4096
对应生成的私钥 id_ed25519 和公钥 id_ed25519.pub, 其他配置步骤同rsa生成方式一致。

Update your browser to view this website correctly.&npsb;Update my browser now