📄 e1014. determining if a style attribute applies to a character or the paragraph.txt
字号:
All style attributes as defined in StyleConstants are either character- or paragraph-based attributes. See also e1010 Listing the Attributes in a Style.
boolean b;
// Check if character-based attribute
b = StyleConstants.Italic instanceof AttributeSet.CharacterAttribute; // true
b = StyleConstants.LineSpacing instanceof AttributeSet.CharacterAttribute; // false
// Check if paragraph-based attribute
b = StyleConstants.LineSpacing instanceof AttributeSet.ParagraphAttribute; // true
b = StyleConstants.Italic instanceof AttributeSet.ParagraphAttribute; // false
It is also possible to determine if the attribute is a color or a font-related attribute.
// Check if color-based attribute
b = StyleConstants.Foreground instanceof AttributeSet.ColorAttribute; // true
b = StyleConstants.Italic instanceof AttributeSet.ColorAttribute; // false
// Check if font-based attribute
b = StyleConstants.Italic instanceof AttributeSet.FontAttribute; // true
b = StyleConstants.Foreground instanceof AttributeSet.FontAttribute; // false
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -