First to show you the effect of the map, the third party open source Android tickplusdrawable related knowledge of friends to study together.
Android Tickplusdrawable (tickplusdrawable) is a state that can be animated by switching buttons, Android Tickplusdrawable (tickplusdrawable) on the GitHub Project homepage is: https://github.com/flavienlaurent/tickplusdrawable
Test code:
Layout:
<framelayout xmlns:android= "http://schemas.android.com/apk/res/android"
android:layout_width= "Match_ Parent "
android:layout_height=" match_parent ">
<view
android:id=" @+id/view "
android: layout_gravity= "center"
android:padding= "30DP"
android:layout_width= "128DP"
android:layout_height= "128DP"/>
Java code:
Package com.flavienlaurent.tickplusdrawable;
Import Android.annotation.TargetApi;
Import android.app.Activity;
Import Android.os.Build;
Import Android.os.Bundle;
Import Android.view.View;
The public class Mainactivity extends activity {
@TargetApi (build.version_codes). Jelly_bean)
@Override
protected void onCreate (Bundle savedinstancestate) {
super.oncreate ( Savedinstancestate);
Setcontentview (r.layout.activity_main);
View view = Findviewbyid (R.id.view);
The first parameter represents the width of the inside + and tick, the second is the circle background color and the tick color,
//The third parameter is the default plus color, showing only one
final tickplusdrawable tickplusdrawable = New Tickplusdrawable (Ten,
0xff9c27b0, 0xff2196f3);
View.setbackground (tickplusdrawable);
View.setonclicklistener (New View.onclicklistener () {
@Override public
void OnClick (View v) {
Tickplusdrawable.toggle ();}}
);
}
The above content is small to share the third party open source Android Tickplusdrawable state can be animated toggle button, I hope you like.