當前位置: 首頁>>代碼示例>>Java>>正文


Java FloatingActionButton.getDrawable方法代碼示例

本文整理匯總了Java中android.support.design.widget.FloatingActionButton.getDrawable方法的典型用法代碼示例。如果您正苦於以下問題:Java FloatingActionButton.getDrawable方法的具體用法?Java FloatingActionButton.getDrawable怎麽用?Java FloatingActionButton.getDrawable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.support.design.widget.FloatingActionButton的用法示例。


在下文中一共展示了FloatingActionButton.getDrawable方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: init

import android.support.design.widget.FloatingActionButton; //導入方法依賴的package包/類
private void init(Context context){

        actionButton=new FloatingActionButton(context);
        toolbarLayout=new LinearLayout(getContext());
        float density = getResources().getDisplayMetrics().density;
        addView(actionButton,(int)(56*density),(int)(56*density));
        FrameLayout.LayoutParams params=
                FrameLayout.LayoutParams.class.cast(actionButton.getLayoutParams());
        params.gravity= Gravity.CENTER;
        actionButton.setLayoutParams(params);
        toolbarLayout.setGravity(Gravity.CENTER);
        actionButton.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                onButtonClick();
            }
        });

        fabDrawable=actionButton.getDrawable();
        if(fabDrawable!=null) actionButton.setImageDrawable(fabDrawable);
        setToolbarColor(-1);


    }
 
開發者ID:vpaliyX,項目名稱:Expandable-Action-Button,代碼行數:25,代碼來源:ExpandableButtonView.java

示例2: setOrAnimatePlusCheckIcon

import android.support.design.widget.FloatingActionButton; //導入方法依賴的package包/類
public void setOrAnimatePlusCheckIcon(final FloatingActionButton fab, boolean isCheck,
                                      boolean allowAnimate) {
    if (!hasL()) {
        compatSetOrAnimatePlusCheckIcon(fab, isCheck, allowAnimate);
        return;
    }

    Drawable drawable = fab.getDrawable();
    if (!(drawable instanceof AnimatedStateListDrawable)) {
        Resources res = mActivity.getResources();
        drawable = res.getDrawable(R.drawable.add_schedule_fab_icon_anim);
        drawable.setTint(res.getColor(R.color.fab_icon_color));
        fab.setImageDrawable(drawable);
    }

    if (allowAnimate) {
        drawable.setState(isCheck ? STATE_UNCHECKED : STATE_CHECKED);
        drawable.jumpToCurrentState();
        drawable.setState(isCheck ? STATE_CHECKED : STATE_UNCHECKED);
    } else {
        drawable.setState(isCheck ? STATE_CHECKED : STATE_UNCHECKED);
        drawable.jumpToCurrentState();
    }
}
 
開發者ID:dreaminglion,項目名稱:iosched-reader,代碼行數:25,代碼來源:LUtils.java

示例3: fabClicked

import android.support.design.widget.FloatingActionButton; //導入方法依賴的package包/類
public void fabClicked(View v) {
    if (v instanceof FloatingActionButton) {
        FloatingActionButton fab = (FloatingActionButton) v;
        Drawable drawable = fab.getDrawable();
        if (drawable instanceof Animatable) {
            ((Animatable) drawable).start();
        }
    }
    new Handler().postDelayed(new Runnable() {
        @Override
        public void run() {
            Intent i = new Intent();
            i.setAction(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA);
            if (i.resolveActivity(getPackageManager()) != null) {
                startActivity(i);
            } else {
                Toast.makeText(MainActivity.this, getString(R.string.error), Toast.LENGTH_SHORT).show();
            }
        }
    }, (int) (500 * Util.getAnimatorSpeed(this)));
}
 
開發者ID:kollerlukas,項目名稱:Camera-Roll-Android-App,代碼行數:22,代碼來源:MainActivity.java


注:本文中的android.support.design.widget.FloatingActionButton.getDrawable方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。