Android5.0 differs from 4.x, and android5.04.x
Previously developed projects run perfectly in 4.x, but when users upgrade to over 5.0, there is an inexplicable bug. The following are differences summarized in bug modification! (Continuous update)
The general feeling is that after 5.0, programmers have higher coding requirements, not as casual as the 4. X Series (* ^__^ ......
1. The View must be a ViewGroup such as LinearLayout or RelativeLayout. In 4.x, it can be a View. After 5.0, the View settings are invalid.
/*** Set the control relative to the screen height or width * @ param context * @ param view control * @ param rate ratio * @ param orientation for example, set the width and height, set */public static void setHeight (Context context, View view, double rate, int orientation) {WindowManager manager = (WindowManager) context. getSystemService (Context. WINDOW_SERVICE); int width = manager. getdefadisplay display (). getWidth (); int height = manager. getdefadisplay display (). getHeight (); switch (orientation) {case WIDTH: view. getLayoutParams (). width = (int) (width * rate); break; case HEIGHT: view. getLayoutParams (). height = (int) (height * rate); break; case BOTH: view. getLayoutParams (). width = (int) (width * rate); view. getLayoutParams (). height = (int) (height * rate); break; case BOTHWIDTH: view. getLayoutParams (). width = (int) (width * rate); view. getLayoutParams (). height = (int) (width * rate); break ;}}