ICInAppBannerNotificationViewBinder
This class implements the ICInAppNotificationViewBinder and will represent the Banner InApp Notification
Styling
The style of the Banner can be set by configuring the appropriate style attributes within your apps styles.xml.
Internally ICInAppBannerNotificationViewBinder leverages the lower level components which utilizes the style attributes. Therefore, the style is applied to that individual components.
First, define styles which inherit from the defaults provided by the SDK and set the appropriate attributes:
<style name="ICInAppBannerNotificationViewChild" parent="@style/ ICInAppBannerNotificationView ">
<item name="titleTextColor">@color/title_text_light</item>
<item name="titleTextSize">@dimen/default_title_text_size</item>
<item name="titleTextTypeface">bold</item>
<item name="textColor">@color/sonic_silver</item>
<item name="textSize">@dimen/default_text_size </item>
<item name="textTypeface">normal</item>
<item name="backgroundColor">@android:color/white</item>
<item name="buttonTextColor">@color/btn_text_light</item>
<item name="buttonTextSize">@dimen/default_text_size</item>
<item name="buttonTextTypeface">normal</item>
<item name="buttonBackgroundColor">@android:color/white</item>
<item name="closeButtonSrc">@drawable/ic_close_light</item>
<item name="expandButtonSrc">@drawable/ic_expand_light</item>
<item name="collapseButtonSrc">@drawable/ic_collapse_light</item>
</style>
Finally, apply the style within the app theme:
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name=" ICInAppBannerNotificationView ">@style/ICInAppBannerNotificationViewChild</item>
…..
</style>
SDK supports Light and Dark themes for Banner InAppNotification. By default Light theme will be applied for Banner.
Please find below sample code for applying Dark Theme to Banner InAppNotification.
Sample code for Applying Dark theme to Banner:
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="ICInAppBannerNotificationView">@style/ICInAppBannerNotificationView.Dark</item>
…..
</style>
Style attributes
ICInAppBannerNotificationView
Name | Description | Example | Supported Values |
---|---|---|---|
titleTextColor t | text color for the InAppNotification Title | Ex: @color/default_title_text_color | A color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb". |
titleTextSize | text size for the InAppNotification Title | Ex : @dimen/default_title_text_size | A dimension value, which is a floating point number appended with a unit such as "14.5sp". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), and mm (millimeters). |
titleTextTypeface | Typeface for the InAppNotification title | Ex: normal | Must be one of the following constant values monospace(3),normal(0),sans(1),serif (2) |
textColor | Text color for InAppNotification body | Ex: @color/befault_text_color | A color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb". |
textSize | Text size for InAppNotification Body | Ex: @dimen/default_text_size | A dimension value, which is a floating point number appended with a unit such as "14.5sp". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), and mm (millimeters). |
backgroundColor | Background colour for InAppNotification | Ex: @color/default_bg_color | May be a reference to another resource, in the form "@[+][package:]type/name" or a theme attribute in the form "?[package:]type/name". May be a color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb". |
buttonTextColor | Text color for InAppNotification button | Ex: @color/button_text_color | May be a color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb". |
buttonTextSize | Text size for InAppNotification button | Ex: @dimen/default_text_size | May be a dimension value, which is a floating point number appended with a unit such as "14.5sp". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), and mm (millimeters). |
buttonTextTypeface | Typeface for InAppNotification button | Ex: normal | Must be one of the following constant values monospace(3),normal(0),sans(1),serif (2) |
buttonBackgroundColor | Background color for InAppNotification button | Ex: @color/button_text_color | May be a color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb". |
closeButtonSrc | Image resource for InAppNotification close button | Ex: @drawable/ic_close | Reference to a drawable resource to use for the close Button. |
expandButtonSrc | Image resource for InAppNotification expand button | Ex: @ drawable / ic_expand | Reference to a drawable resource to use for the expand Button. |
collapseButtonSrc | Image resource for InAppNotification collapse button | Ex: @ drawable / ic_collapse | Reference to a drawable resource to use for the collapse Button. |
Updated about 1 year ago