Android浮动按纽:Floating Action Button library for Android
jopen
10年前
一个浮动按钮,拥有许多自定义的属性。浮动的操作按钮被用于一种特殊类型的促进作用。它们是由一个圆圈图标漂浮在UI上述区分,并有相关的变形,发射,并转印锚点特殊运动行为。
//Button type actionButton.setType(FloatingActionButton.Type.MINI); //Button colors actionButton.setButtonColor(getResources().getColor(R.color.fab_material_lime_500)); actionButton.setButtonColorPressed(getResources().getColor(R.color.fab_material_lime_900)); //Image actionButton.setImageDrawable(getResources().getDrawable(R.drawable.fab_plus_icon)); actionButton.setImageSize(24.0f); //Shadow actionButton.setShadowColor(Color.parseColor("#757575")); actionButton.setShadowRadius(1.0f); actionButton.setShadowXOffset(0.5f); actionButton.setShadowYOffset(1.0f); //Stroke actionButton.setStrokeColor(getResources().getColor(R.color.fab_material_blue_grey_500)); actionButton.setStrokeWidth(1.0f); //Animations actionButton.setAnimationOnShow(FloatingActionButton.Animations.ROLL_FROM_DOWN); actionButton.setAnimationOnHide(FloatingActionButton.Animations.ROLL_TO_DOWN);
Animations
The Library has several predefined animations:
Fade In - Fade Out | Roll From Down - Roll To Down | Jump From Down - Jump To Down |
---|---|---|