Tab.Builder
public final class Tab.Builder
A builder of Tab.
Summary
Public constructors |
|---|
Builder()Returns an empty |
Public methods |
|
|---|---|
@NonNull Tab |
build()Constructs the |
@NonNull Tab.Builder |
setContentId(@NonNull String contentId)Sets the content ID of the tab. |
@NonNull Tab.Builder |
Sets the icon to display in the tab. |
@NonNull Tab.Builder |
setTitle(@NonNull CharSequence title)Sets the title of the tab. |
Public constructors
Public methods
build
public @NonNull Tab build()
Constructs the Tab defined by this builder.
| Throws | |
|---|---|
java.lang.IllegalStateException |
if the tab's title, icon or content ID is not set. |
setContentId
public @NonNull Tab.Builder setContentId(@NonNull String contentId)
Sets the content ID of the tab.
| Throws | |
|---|---|
java.lang.NullPointerException |
if |
java.lang.IllegalArgumentException |
if |
setIcon
public @NonNull Tab.Builder setIcon(@NonNull CarIcon icon)
Sets the icon to display in the tab.
Icon Sizing Guidance To minimize scaling artifacts across a wide range of car screens, apps should provide icons targeting a 36 x 36 dp bounding box. If the icon exceeds this maximum size in either one of the dimensions, it will be scaled down to be centered inside the bounding box while preserving its aspect ratio.See CarIcon for more details related to providing icon and image resources that work with different car screen pixel densities.
| Throws | |
|---|---|
java.lang.NullPointerException |
if |
setTitle
public @NonNull Tab.Builder setTitle(@NonNull CharSequence title)
Sets the title of the tab.
Only DistanceSpans and DurationSpans are supported in the input string.
| Throws | |
|---|---|
java.lang.NullPointerException |
if |
java.lang.IllegalArgumentException |
if |