随笔(二十四)

本文介绍了Android开发中的多项实用技巧,包括使用AndroidStudio快捷键进行大小写切换、自定义PopupWindow的显示位置、RxJava2中调度器Scheduler的使用方法、通过动画实现背景渐变效果以及getDrawable和getColor的替代方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.Android Studio 快捷键之切换大小写
大小写切换
Ctrl+Shift+U
Edit ToggleCase
2.Android自定义PopupWindow显示在控件上方或者下方
https://www.cnblogs.com/woaixingxing/p/5563171.html
https://www.jb51.net/article/106192.htm
https://www.jianshu.com/p/825d1cc9fa79
https://blog.youkuaiyun.com/ben0612/article/details/43191205
https://blog.youkuaiyun.com/dxj007/article/details/8026691
https://blog.youkuaiyun.com/Justwen26/article/details/61621076
3.[Android开发] RxJava2之路三 - 调度器Scheduler与线程控制
https://blog.youkuaiyun.com/niubitianping/article/details/54952827
observeOn() 指定的是它之后的操作所在的线程。因此如果有多次切换线程的需求,只要在每个想要切换线程的位置调用一次 observeOn() 即可。 subscribeOn() 的位置放在哪里都可以,但它是只能调用一次的。

Observable.just(1, 2, 3, 4) // IO 线程,由 subscribeOn() 指定
.subscribeOn(Schedulers.io())
.observeOn(Schedulers.newThread())
.map(mapOperator) // 新线程,由 observeOn() 指定
.observeOn(Schedulers.io())
.map(mapOperator2) // IO 线程,由 observeOn() 指定
.observeOn(AndroidSchedulers.mainThread)
.subscribe(subscriber); // Android 主线程,由 observeOn() 指定

4.Android利用动画实现背景逐渐变暗
https://www.jb51.net/article/100125.htm
0-255
/**
* Specify an alpha value for the drawable. 0 means fully transparent, and
* 255 means fully opaque.
*/
public abstract void setAlpha(@IntRange(from=0,to=255) int alpha);
5.Android中getDrawable和getColor过时的替代方法

int colorInt = getResources().getColor(R.color.colorAccent);//返回的是color的int类型值:-49023
int colorInt2 = ContextCompat.getColor(this, R.color.colorAccent);//返回的是color的int类型值:-49023

Drawable drawable = getResources().getDrawable(R.mipmap.ic_launcher);
Drawable drawable2 = ContextCompat.getDrawable(this,R.mipmap.ic_launcher);
6.android中如何获得drawable的颜色值?
https://zhidao.baidu.com/question/455188910525242005.html
setBackgroundDrawable(new ColorDrawable(color));
7.HeaderViewListAdapter cannot be cast to listAdapter问题原因及解决办法
https://www.cnblogs.com/misybing/p/5042482.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值