过时方法(待解决)

颜色

旧
getResources().getColor(R.color.locationCircle35)
新
ContextCompat.getColor(GdActivity.this, R.color.locationCircle35)

通知(待解决)

旧
NotificationCompat.Builder(this)
新
xxx

APP(待解决)

旧
manager.getRunningTasks
新
xxx

屏宽高

旧
WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
Display display = wm.getDefaultDisplay();
int width, height;
width = display.getWidth();
height = display.getHeight();
新
WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
Display display = wm.getDefaultDisplay();
Point size = new Point();
int width, height;
display.getSize(size);
width = size.x;
height = size.y;

键盘

旧
android.text.ClipboardManager clipboardManager = (android.text.ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
新
android.content.ClipboardManager clipboardManager = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
旧
clipboardManager.setText(text);
新
clipboardManager.setPrimaryClip(ClipData.newPlainText("content", text));
旧
getText
新
getPrimaryClip
旧
hasText
新
hasPrimaryClip

View(待解决)

旧
canvas.clipPath(mCircularPath, Region.Op.DIFFERENCE);
新
xxx
旧
canvas.clipRect(mTempRect, Region.Op.DIFFERENCE);
新
xxx

Drawable

旧
getContext().getResources().getDrawable(resourceId)
新
ContextCompat.getDrawable(getContext(), resourceId)

RecyclerView

旧
parent.getChildPosition(view)
新
parent.getChildLayoutPosition(view)

抽屉按钮

ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawerLayout, toolBar, R.string.cancel, R.string.cancel);
旧
drawerLayout.setDrawerListener(toggle);
新
drawerLayout.addDrawerListener(toggle);

html解析

旧
Html.fromHtml(String);
新
Html.fromHtml(String source, int flags);

PoupWindow

旧
popupWindow.setBackgroundDrawable(new BitmapDrawable());
新
popupWindow.setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));

透明度

旧
imageView.setAlpha(alpha);
新
imageView.setImageAlpha(alpha);

WebView(待进一步探究新法)

旧
@Deprecated
public boolean shouldOverrideUrlLoading(WebView view, String url) {
    throw new RuntimeException("Stub!");
}
新
public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
    throw new RuntimeException("Stub!");
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

snpmyn

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值