Summarize the experience in project development, reduce the occurrence of similar situation, improve the development efficiency:
Example:
First, the layout file for TextView set textcolor and background color differences:
Background corresponds to selector:
TextColor corresponding to the selector:
Distinguish the difference O (∩_∩) o~, avoid wasting unnecessary development time ~ ~
Second, radiogroup+fragment write bottom navigation, radiogroup in the RadioButton can not modify the size of the Drawabletop picture:
I don't think the size of the four icons on the side is appropriate, but it doesn't change the size.
The following setbounds method can roughly resolve the problem, but may not be the best solution.
Displaymetrics dm = new Displaymetrics (); This.getwindowmanager (). Getdefaultdisplay (). Getmetrics (DM); int width = Dm.widthpixels;int height = dm.heightpixels;if (width <= 854 && height <= 480) {size =,} else if (Width & lt;= && Height <= 720) {size = $;} else {size = 70;} RADIOBTN1 = (RadioButton) radiogroup.getchildat (0); image1 = This.getresources (). Getdrawable (R.drawable.btn_selector _compete); image1.setbounds (0, 0, size, size), Radiobtn1.setcompounddrawables (null, image1, NULL, NULL); radioBtn2 = ( RadioButton) Radiogroup.getchildat (1); image2 = This.getresources (). getdrawable (R.drawable.btn_selector_message); Image2.setbounds (0, 0, size, size); Radiobtn2.setcompounddrawables (null, image2, NULL, NULL); radioBtn3 = (RadioButton) Radiogroup.getchildat (2); image3 = This.getresources (). getdrawable (r.drawable.btn_selector_home_unpressed); Image3.setbounds (0, 0, size, size); Radiobtn3.setcompounddrawables (null, IMAGE3, NULL, NULL); radioBtn4 = (RadioButton) Radiogroup.geTchildat (3); image4 = This.getresources (). getdrawable (R.drawable.btn_selector_discovery); image4.setbounds (0, 0, Size, size), Radiobtn4.setcompounddrawables (null, IMAGE4, NULL, NULL), RadioBtn5 = (RadioButton) Radiogroup.getchildat ( 4); image5 = This.getresources (). getdrawable (r.drawable.btn_selector_myself); image5.setbounds (0, 0, size, size); Radiobtn5.setcompounddrawables (NULL, IMAGE5, NULL, NULL);
If there is a better solution, please leave a message oh ~
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Android Development Knowledge Points Summary