ui.SplitPanel.style

傳回小工具的樣式 ActiveDictionary,可修改以更新小工具的樣式。

行為與對應 CSS 屬性類似的屬性:

  - height、maxHeight、minHeight (例如「100px」)

  - width、maxWidth、minWidth (例如「100px」)

  - 邊框間距、邊界 (例如「4px 4px 4px 4px」或簡稱「4px」)

  - color、backgroundColor (例如「red」或「#FF0000」)

  - 邊框 (例如「1px solid black」)

  - borderColor (例如「red black blue #FF0000」)

  - borderRadius (例如「10px」)

  - borderStyle (例如「solid dashed none dotted」)

  - borderWidth (例如「1px 0px 1px 0px」)

  - fontSize (例如「24px」)

  - fontStyle (例如「italic」)

  - fontWeight (例如「bold」或「100」)

  - fontFamily (例如「monospace」或「serif」)

  - textAlign (例如「left」或「center」)

  - textDecoration (例如「underline」或「line-through」)

  - whiteSpace (例如「nowrap」或「pre」)

  - shown (true 或 false)

支援的自訂版面配置屬性 (請參閱 ui.Panel.Layout 說明文件):

  - 延展 ('horizontal'、'vertical'、'both')

  - position ('top-right'、'top-center'、'top-left'、'bottom-right' 等)

用量傳回
SplitPanel.style()ui.data.ActiveDictionary
引數類型詳細資料
這個:ui.widgetui.Widgetui.Widget 執行個體。

範例

程式碼編輯器 (JavaScript)

// Define a UI widget and add it to the map.
var widget = ui.SplitPanel({style: {width: '400px', height: '200px'}});
Map.add(widget);

// View the UI widget's style properties; an ActiveDictionary.
print(widget.style());

// ActiveDictionaries are mutable; set a style property.
widget.style().set('backgroundColor', 'lightgray');
print(widget.style());

// Define the UI widget's style ActiveDictionary as a variable.
var widgetStyle = widget.style();
print(widgetStyle);

// Set the UI widget's style properties from the ActiveDictionary variable.
widgetStyle.set({border: '5px solid darkgray'});
print(widgetStyle);