Skip to content
This repository was archived by the owner on Jun 30, 2022. It is now read-only.

GhostButton

IGR777 edited this page Oct 9, 2018 · 5 revisions

Button with no background.

GhostButton inherits from AppCompatButton/UIButton.

Customization fields

Type Field Description Default value
FontStyleItem FontStyle Responsible for font customization for enabled button state.
UIFont
Typeface
Font
Typeface
Responsible for button's title font. System
Roboto bold
float LetterSpacing Responsible for buttons title letters spacing. -0.0046f
float TextSize Responsible for buttons title text size. 13
UIColor
Color
TextColor Responsible for buttons title text color in normal state. #3C6DF0
UIColor
Color
DisabledTextColor Responsible for buttons title text color in disabled state. #C0BFC0
UIColor
Color
RippleColor Responsible for button's ripple color. #293C6DF0

Notes

  • has a ripple effect when you press the button.
  • background is always transparent.
  • iOS ripple color implementation set 10% alpha for colors with 100% alpha. Android ripple has default implementation, it's set 50% of selected color.

Usage

Android

For Android platform, there are two ways to add GhostButton to the layout: to the axml markup file or from the code behind.

Sample for creating GhostButton in code behind for Android:

var ghostButton = new GhostButton(Context);
ghostButton.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent);
ghostButton.TextSize = 15;
ghostButton.LetterSpacing = 3;
ghostButton.TextColor = Color.Red;

Sample for creating GhostButton in axml markup for Android:

<EOS.UI.Droid.Controls.GhostButton
    android:id="@+id/ghostButton"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Ghost Button" />

Note: For customization Typeface you should add a file with a custom font to assets.

iOS

For iOS Ghost button can be added from the .xib/storyboards files or from code behind.

Sample for creating GhostButton in code behind for IOS:

var ghostButton = new GhostButton();
ghostButton.Frame = new CGRect(0, 0, 88, 28);
ghostButton.FontStyle = new FontStyleItem()
{
    Color = ColorExtension.FromHex(brandPrimaryColor),
    Font = UIFont.SystemFontOfSize(13f, UIFontWeight.Semibold),
    Size = 13f,
    LetterSpacing = -0.6f,
    LineHeight = 15f
}
Clone this wiki locally