任何问题请联系WX:uu16853

买模板送网站采集器 让你轻松放开双手运营网站!

购买更多有优惠!

Android控件开发之ToggleButton原理 Android开发技术

  在Android平台上比较有特色的就是ToggleButton控件,虽然它的功能和CheckBox有些类似,但是他们的用处还是有一定的区别比如ToggleButton原本有图片装饰,通过ToggleButton可以很清楚的显示某些状态。它们均从Button为基类的CompoundButton中实现,其真假事件从Checkable来实现。   public abstract class CompoundButton extends Button implements Checkable {    private boolean mChecked; //状态是否选中    private int mButtonResource;    private boolean mBroadcasting;    private Drawable mButtonDrawable; //按钮的图标    private OnCheckedChangeListener mOnCheckedChangeListener; //选中状态改变监听    private OnCheckedChangeListener mOnCheckedChangeWidgetListener;     private static final int[] CHECKED_STATE_SET = {        R.attr.state_checked    };     public CompoundButton(Context context) {        this(context, null);    }     public CompoundButton(Context context, […]

100% Secure Checkout

PayPal / MasterCard / Visa