本文整理匯總了Java中com.melnykov.fab.FloatingActionButton.setType方法的典型用法代碼示例。如果您正苦於以下問題:Java FloatingActionButton.setType方法的具體用法?Java FloatingActionButton.setType怎麽用?Java FloatingActionButton.setType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.melnykov.fab.FloatingActionButton
的用法示例。
在下文中一共展示了FloatingActionButton.setType方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setUpFAB
import com.melnykov.fab.FloatingActionButton; //導入方法依賴的package包/類
/**
* Setup utility for the FAB
*
* @param context
* @param icon the icon to apply
* @param button the FAB button
* @param mFABlistener the listener to apply
*/
public static void setUpFAB(Activity context, int icon, FloatingActionButton button, View.OnClickListener mFABlistener) {
button.setVisibility(View.VISIBLE);
button.setType(FloatingActionButton.TYPE_NORMAL);
if (ThemeUtils.getAppTheme3(context) < 6) {
button.setColorNormal(context.getResources().getColor(
ThemeUtils.getDrawableColor(ThemeUtils.getAppTheme3(context), context)));
button.setColorPressed(context.getResources().getColor(
ThemeUtils.getDrawableColor(ThemeUtils.getAppTheme3(context), context)));
} else {
button.setColorNormal(ThemeUtils.getDrawableColor(ThemeUtils.getAppTheme3(context), context));
button.setColorPressed(ThemeUtils.getDrawableColor(ThemeUtils.getAppTheme3(context), context));
}
button.setImageDrawable(context.getResources().getDrawable(icon));
button.setOnClickListener(mFABlistener);
}
示例2: setupMenuItem
import com.melnykov.fab.FloatingActionButton; //導入方法依賴的package包/類
private static FloatingActionButton setupMenuItem(FloatingActionButton menuBase, int id,
int drawable,
int style,
View.OnClickListener menuItemClickListener) {
int[] styleValues = new int[]{com.melnykov.fab.R.attr.fab_colorNormal,
com.melnykov.fab.R.attr.fab_colorPressed,
com.melnykov.fab.R.attr.fab_colorRipple,
com.melnykov.fab.R.attr.fab_shadow};
Context context = menuBase.getContext();
TypedArray array = context.obtainStyledAttributes(style, styleValues);
int color;
FloatingActionButton button = new FloatingActionButton(menuBase.getContext(), null, style);
button.setId(id);
button.setType(menuBase.getType());
if ((color = array.getColor(0, -1)) != -1)
button.setColorNormal(color);
if ((color = array.getColor(1, -1)) != -1)
button.setColorPressed(color);
if ((color = array.getColor(2, -1)) != -1)
button.setColorRipple(color);
if (array.getBoolean(3, false))
button.setShadow(true);
else
button.setShadow(false);
array.recycle();
button.setImageResource(drawable);
button.setLayoutParams(menuBase.getLayoutParams());
button.setVisibility(View.GONE);
button.setOnClickListener(menuItemClickListener);
((ViewGroup) menuBase.getParent()).addView(button);
return button;
}
示例3: onCreate
import com.melnykov.fab.FloatingActionButton; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_tumblr);
createFabFrameAnim();
createFabReverseFrameAnim();
findViewById(R.id.text_view).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(TumblrStyleActivity.this, "Click", Toast.LENGTH_SHORT).show();
}
});
final FloatingActionButton fab = new FloatingActionButton(this);
fab.setType(FloatingActionButton.TYPE_NORMAL);
fab.setImageDrawable(frameAnim);
// fab.setImageResource(android.R.drawable.ic_dialog_email);
fab.setColorPressedResId(R.color.colorPrimary);
fab.setColorNormalResId(R.color.fab);
fab.setColorRippleResId(R.color.text_color);
fab.setShadow(true);
springFloatingActionMenu = new SpringFloatingActionMenu.Builder(this)
.fab(fab)
.addMenuItem(R.color.photo, R.mipmap.ic_messaging_posttype_photo, "Photo", R.color.text_color,this)
.addMenuItem(R.color.chat, R.mipmap.ic_messaging_posttype_chat, "Chat", R.color.text_color,this)
.addMenuItem(R.color.quote, R.mipmap.ic_messaging_posttype_quote, "Quote", R.color.text_color,this)
.addMenuItem(R.color.link, R.mipmap.ic_messaging_posttype_link, "Link", R.color.text_color,this)
.addMenuItem(R.color.audio, R.mipmap.ic_messaging_posttype_audio, "Audio", R.color.text_color,this)
.addMenuItem(R.color.text, R.mipmap.ic_messaging_posttype_text, "Text", R.color.text_color,this)
.addMenuItem(R.color.video, R.mipmap.ic_messaging_posttype_video, "Video", R.color.text_color,this)
.animationType(SpringFloatingActionMenu.ANIMATION_TYPE_TUMBLR)
.revealColor(R.color.colorPrimary)
.gravity(Gravity.RIGHT | Gravity.BOTTOM)
.onMenuActionListner(new OnMenuActionListener() {
@Override
public void onMenuOpen() {
fab.setImageDrawable(frameAnim);
frameReverseAnim.stop();
frameAnim.start();
}
@Override
public void onMenuClose() {
fab.setImageDrawable(frameReverseAnim);
frameAnim.stop();
frameReverseAnim.start();
}
})
.build();
Toolbar mToolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(mToolbar);
setTitle("SpringFloatingActionMenu");
}
示例4: onCreate
import com.melnykov.fab.FloatingActionButton; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_bloom);
createFabFrameAnim();
createFabReverseFrameAnim();
final FloatingActionButton fab = new FloatingActionButton(this);
fab.setType(FloatingActionButton.TYPE_NORMAL);
fab.setImageDrawable(frameAnim);
// fab.setImageResource(android.R.drawable.ic_dialog_email);
fab.setColorPressedResId(R.color.colorPrimary);
fab.setColorNormalResId(R.color.fab);
fab.setColorRippleResId(R.color.text_color);
fab.setShadow(true);
springFloatingActionMenu = new SpringFloatingActionMenu.Builder(this)
.fab(fab)
.addMenuItem(R.color.photo, R.mipmap.ic_messaging_posttype_photo, "Photo", R.color.text_color,this)
.addMenuItem(R.color.chat, R.mipmap.ic_messaging_posttype_chat, "Chat", R.color.text_color,this)
.addMenuItem(R.color.quote, R.mipmap.ic_messaging_posttype_quote, "Quote", R.color.text_color,this)
.addMenuItem(R.color.link, R.mipmap.ic_messaging_posttype_link, "Link", R.color.text_color,this)
.addMenuItem(R.color.audio, R.mipmap.ic_messaging_posttype_audio, "Audio", R.color.text_color,this)
.addMenuItem(R.color.text, R.mipmap.ic_messaging_posttype_text, "Text", R.color.text_color,this)
.addMenuItem(R.color.video, R.mipmap.ic_messaging_posttype_video, "Video", R.color.text_color,this)
.animationType(SpringFloatingActionMenu.ANIMATION_TYPE_BLOOM)
.revealColor(R.color.colorPrimary)
.gravity(Gravity.RIGHT | Gravity.BOTTOM)
.onMenuActionListner(new OnMenuActionListener() {
@Override
public void onMenuOpen() {
fab.setImageDrawable(frameAnim);
frameReverseAnim.stop();
frameAnim.start();
}
@Override
public void onMenuClose() {
fab.setImageDrawable(frameReverseAnim);
frameAnim.stop();
frameReverseAnim.start();
}
})
.build();
Toolbar mToolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(mToolbar);
setTitle("SpringFloatingActionMenu");
}