top_bottom_darker_gradient.xml


Overview

`top_bottom_darker_gradient.xml` is an Android drawable resource file defining a vertical gradient shape. This drawable is primarily used to create a visual overlay with a smooth transition from a darker color at the top and bottom edges to a lighter color in the center. It serves as a background or overlay element, commonly applied in user interface components such as media player controls or other UI panels to enhance readability and aesthetics by subtly darkening edges while keeping the center area lighter.


Detailed Explanation

XML Structure and Elements

Attributes of <gradient>

Attribute

Description

Value in this file

`android:angle`

Defines the angle of the gradient direction.

`90` (Gradient flows vertically from top to bottom)

`android:startColor`

The color at the start of the gradient.

`@color/tubi_tv_player_controls_overlay_dark` (A dark color resource)

`android:centerColor`

The color at the center position of the gradient.

`@color/tubi_tv_player_controls_overlay_light` (A lighter color resource)

`android:endColor`

The color at the end of the gradient.

`@color/tubi_tv_player_controls_overlay_dark` (Same dark color as startColor, creating darker edges)


Usage

This drawable can be applied as a background to Views or ViewGroups in Android layouts. For example:

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@drawable/top_bottom_darker_gradient">

    <!-- UI elements overlaid on the gradient background -->

</RelativeLayout>

This results in a vertically oriented overlay gradient that darkens the top and bottom edges, improving contrast and visual focus on the center content.


Implementation Details


Interaction with Other System Components


Visual Diagram

flowchart TD
    A[Start: Drawable <shape>] --> B[Gradient <gradient>]
    B --> C{Gradient Attributes}
    C --> D[angle=90 (vertical gradient)]
    C --> E[startColor: dark overlay color]
    C --> F[centerColor: light overlay color]
    C --> G[endColor: dark overlay color]
    style A fill:#f9f,stroke:#333,stroke-width:2px
    style B fill:#bbf,stroke:#333,stroke-width:2px
    style C fill:#fbf,stroke:#333,stroke-width:2px
    style D fill:#afa,stroke:#333,stroke-width:1px
    style E fill:#afa,stroke:#333,stroke-width:1px
    style F fill:#afa,stroke:#333,stroke-width:1px
    style G fill:#afa,stroke:#333,stroke-width:1px

Summary

This simple yet effective drawable enhances UI design by applying subtle visual gradients that improve readability and aesthetic appeal.