本文整理汇总了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");
}