颜色
旧
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!");
}