DynamicLayout中的显示参数是什么
What is the display parameter in DynamicLayout
相比之下,DynamicLayout
constructor has a base
parameter and a display
parameter, both of which are CharSequence
. (StaticLayout
缺少这一点。)
DynamicLayout (CharSequence base,
CharSequence display,
TextPaint paint,
int width,
Layout.Alignment align,
float spacingmult,
float spacingadd,
boolean includepad,
TextUtils.TruncateAt ellipsize,
int ellipsizedWidth)
display
参数是什么意思? documentation says nothing. I looked into the source code and I see both an mBase
and an mDisplay
但我无法弄清楚它们之间的区别。我最好的猜测是 display
与省略号文本有关,尽管我不明白为什么需要传入两个不同的字符序列。
most basic constructor lacks the display
parameter (it is set equal to base
in the source code),所以我假设display
提供了某种可选功能。这是什么?
TextView
uses it with different arguments when there's a TransformationMethod
附上,如<EditText android:password="true"/>
.
DynamicLayout
将更改侦听器附加到基本文本,但以其他方式对转换后的文本执行所有布局。因此,当基本文本被编辑时,它会收到通知,并会更新转换文本中受影响范围的布局。
当 base
= display
时,它正在监视同一 CharSequence
上的变化和计算布局。这是未转换文本的预期行为。
相比之下,DynamicLayout
constructor has a base
parameter and a display
parameter, both of which are CharSequence
. (StaticLayout
缺少这一点。)
DynamicLayout (CharSequence base,
CharSequence display,
TextPaint paint,
int width,
Layout.Alignment align,
float spacingmult,
float spacingadd,
boolean includepad,
TextUtils.TruncateAt ellipsize,
int ellipsizedWidth)
display
参数是什么意思? documentation says nothing. I looked into the source code and I see both an mBase
and an mDisplay
但我无法弄清楚它们之间的区别。我最好的猜测是 display
与省略号文本有关,尽管我不明白为什么需要传入两个不同的字符序列。
most basic constructor lacks the display
parameter (it is set equal to base
in the source code),所以我假设display
提供了某种可选功能。这是什么?
TextView
uses it with different arguments when there's a TransformationMethod
附上,如<EditText android:password="true"/>
.
DynamicLayout
将更改侦听器附加到基本文本,但以其他方式对转换后的文本执行所有布局。因此,当基本文本被编辑时,它会收到通知,并会更新转换文本中受影响范围的布局。
当 base
= display
时,它正在监视同一 CharSequence
上的变化和计算布局。这是未转换文本的预期行为。