Objective
The Android 5.0 knowledge point is finished, the next one to bring you a comprehensive example of the demo, and talk about my view of Android 5.0.
Some people will think why not every blog with a demo, I think no matter what to learn everything needs to practice, so I did not provide demo, I would like to first let everyone own to follow the steps I wrote to achieve this, in the process of implementation will encounter difficulties, and then go to find solutions, Finally, do it yourself, so that we can be impressed by what we have learned.
drawable Tinting (coloring)
Set the Android:tint property of ImageView to achieve the following effects:
Layout
<imageview android:layout_width= "100DP" android:layout_height= "100DP" android:elevation= "1dip" android:layout_gravity= "center" android:src= "@drawable/ic_launcher" /> <imageview android:layout_width= "100DP" android:layout_height= "100DP" android:elevation= "1dip" android:layout_gravity= "center" android:src= "@drawable/ic_launcher" android:tint= "@android: color/ Holo_red_dark " />
Not only can set tint also can set Tintmode, respectively set different mode effect is as follows:
Srceen
Multiply
Add
src_atop/ src_in/ Src_over
Clipping Views (crop view)
First we layout, set the two square TextView
<textview android:id= "@+id/tv_1" android:layout_width= "100DP" android:layout_height= "100DP" android:elevation= "1dip" android:layout_gravity= "center" /> <textview android:id = "@+id/tv_2" android:layout_width= "100DP" android:layout_height= "100DP" android:elevation= "1dip " android:layout_gravity=" center " />
Then we cut them two separately into rounded squares and circles:
<span style= "White-space:pre" ></SPAN>V1 = Findviewbyid (r.id.tv_1); V2 = Findviewbyid (r.id.tv_2); Viewoutlineprovider Viewoutlineprovider = new Viewoutlineprovider () { @Override public void Getoutline (View View, Outline Outline) { outline.setroundrect (0, 0, view.getwidth (), View.getheight (), ten); } }; Viewoutlineprovider viewOutlineProvider1 = new Viewoutlineprovider () { @Override public void Getoutline (View View, Outline Outline) { outline.setroundrect (0, 0, view.getwidth (), View.getheight (), View.getheight ()/2); } }; V1.setoutlineprovider (Viewoutlineprovider); V2.setoutlineprovider (ViewOutlineProvider1);
The effect is as follows:
Ym--android 5.0 Learning tinting and clipping