Most visited

Recently visited

Added in API level 19

PrinterInfo.Builder

public static final class PrinterInfo.Builder
extends Object

java.lang.Object
   ↳ android.print.PrinterInfo.Builder


用于创建 PrinterInfo生成器。

Summary

Public constructors

PrinterInfo.Builder(PrinterId printerId, String name, int status)

构造函数。

PrinterInfo.Builder(PrinterInfo other)

构造函数。

Public methods

PrinterInfo build()

创建一个新的 PrinterInfo

PrinterInfo.Builder setCapabilities(PrinterCapabilitiesInfo capabilities)

设置打印机功能。

PrinterInfo.Builder setDescription(String description)

设置向用户显示的 本地化打印机描述

PrinterInfo.Builder setHasCustomPrinterIcon(boolean hasCustomPrinterIcon)

声明打印服务可以加载每个打印机的自定义图标。

PrinterInfo.Builder setIconResourceId(int iconResourceId)

为此打印机设置一个可绘制资源作为图标。

PrinterInfo.Builder setInfoIntent(PendingIntent infoIntent)

设置启动显示有关打印机的更多信息的活动的 PendingIntent

PrinterInfo.Builder setName(String name)

设置显示给用户的 本地化打印机名称

PrinterInfo.Builder setStatus(int status)

设置打印机状态。

Inherited methods

From class java.lang.Object

Public constructors

PrinterInfo.Builder

Added in API level 19
PrinterInfo.Builder (PrinterId printerId, 
                String name, 
                int status)

构造函数。

Parameters
printerId PrinterId: The printer id. Cannot be null.
name String: The printer name. Cannot be empty.
status int: The printer status. Must be a valid status.
Throws
IllegalArgumentException If the printer id is null, or the printer name is empty or the status is not a valid one.

PrinterInfo.Builder

Added in API level 19
PrinterInfo.Builder (PrinterInfo other)

构造函数。

Parameters
other PrinterInfo: Other info from which to start building.

Public methods

build

Added in API level 19
PrinterInfo build ()

创建一个新的 PrinterInfo

Returns
PrinterInfo A new PrinterInfo.

setCapabilities

Added in API level 19
PrinterInfo.Builder setCapabilities (PrinterCapabilitiesInfo capabilities)

设置打印机功能。

Parameters
capabilities PrinterCapabilitiesInfo: The capabilities.
Returns
PrinterInfo.Builder This builder.

setDescription

Added in API level 19
PrinterInfo.Builder setDescription (String description)

设置向用户显示的 本地化打印机描述

Parameters
description String: The description.
Returns
PrinterInfo.Builder This builder.

setHasCustomPrinterIcon

Added in API level 24
PrinterInfo.Builder setHasCustomPrinterIcon (boolean hasCustomPrinterIcon)

声明打印服务可以加载每个打印机的自定义图标。 如果同时设置了setIconResourceId(int)和自定义图标,则会在加载自定义图标时显示资源图标,但会使用自定义图标。 如果没有设置setIconResourceId(int) ,加载时会显示打印机服务的图标。

该图标是异步请求的,只有在需要时才通过 onRequestCustomPrinterIcon(PrinterId, CancellationSignal, CustomPrinterIconCallback)

Parameters
hasCustomPrinterIcon boolean: If the printer has a custom icon or not.
Returns
PrinterInfo.Builder This builder.

setIconResourceId

Added in API level 24
PrinterInfo.Builder setIconResourceId (int iconResourceId)

为此打印机设置一个可绘制资源作为图标。 如果未设置图标,则打印机的服务图标用于打印机。

Parameters
iconResourceId int: The resource ID of the icon.
Returns
PrinterInfo.Builder This builder.

也可以看看:

setInfoIntent

Added in API level 24
PrinterInfo.Builder setInfoIntent (PendingIntent infoIntent)

设置启动显示有关打印机更多信息的活动的 PendingIntent

Parameters
infoIntent PendingIntent: The intent.
Returns
PrinterInfo.Builder This builder.

setName

Added in API level 19
PrinterInfo.Builder setName (String name)

设置显示给用户的 本地化打印机名称

Parameters
name String: The name.
Returns
PrinterInfo.Builder This builder.

setStatus

Added in API level 19
PrinterInfo.Builder setStatus (int status)

设置打印机状态。

Parameters
status int: The status.
Returns
PrinterInfo.Builder This builder.

也可以看看:

Hooray!