Third-party open source Android tickplusdrawable state can be animated toggle button _android

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.