droid_wrap::android::text

Trait Editable

Source
pub trait Editable:
    CharSequence
    + JObjRef
    + JObjNew
    + PartialEq
    + Debug {
    const CLASS: &'static str = "android/text/Editable";
    const OBJECT_SIG: &'static str = "Landroid/text/Editable;";
    const DIM: u8 = 0u8;

    // Required methods
    fn replace(
        &self,
        st: i32,
        en: i32,
        source: Self::Cs,
        start: i32,
        end: i32,
    ) -> Self::E;
    fn replace_convenience(&self, st: i32, en: i32, text: Self::Cs) -> Self::E;
    fn insert(
        &self,
        where: i32,
        text: Self::Cs,
        start: i32,
        end: i32,
    ) -> Self::E;
    fn insert_convenience(&self, where: i32, text: Self::Cs) -> Self::E;
    fn delete(&self, st: i32, en: i32) -> Self::E;
    fn append_convenience(&self, text: Self::Cs) -> Self::E;
    fn append(&self, text: Self::Cs, start: i32, end: i32) -> Self::E;
    fn append_char(&self, text: char) -> Self::E;
    fn clear(&self);
    fn clear_spans(&self);
}
Expand description

这是文本的接口,其内容和标记可以更改(与字符串等不可变文本相反)。如果您创建可编辑的 DynamicLayout,则布局将随着文本的更改而重新排列。

Provided Associated Constants§

Source

const CLASS: &'static str = "android/text/Editable"

android/text/Editable

Source

const OBJECT_SIG: &'static str = "Landroid/text/Editable;"

Landroid/text/Editable;

Source

const DIM: u8 = 0u8

数组维度

Required Methods§

Source

fn replace( &self, st: i32, en: i32, source: Self::Cs, start: i32, end: i32, ) -> Self::E

用源切片 start…end 的副本替换此 Editable 中指定范围 (st…en) 的文本。目标切片可能为空,在这种情况下操作为插入;源切片可能为空,在这种情况下操作为删除。 在提交更改之前,使用 setFilters 设置的每个过滤器都有机会修改源文本。如果源是 Spanned,则来自源的跨度将保留到 Editable 中。Editable 中完全覆盖替换范围的现有跨度将被保留,但严格在替换范围内的任何跨度将被删除。 如果源包含带有 Spanned.SPAN_PARAGRAPH 标志的跨度,并且它不满足段落边界约束,则不会保留它。作为特殊情况,即使替换了光标所在的整个范围,光标位置也会保留。 返回:对此对象的引用。

Source

fn replace_convenience(&self, st: i32, en: i32, text: Self::Cs) -> Self::E

方便 replace(st, en, text, 0, text.length())

Source

fn insert(&self, where: i32, text: Self::Cs, start: i32, end: i32) -> Self::E

方便 replace(where, where, text, start, end)

Source

fn insert_convenience(&self, where: i32, text: Self::Cs) -> Self::E

方便 replace(where, where, text, 0, text.length());

Source

fn delete(&self, st: i32, en: i32) -> Self::E

方便 replace(st, en, “”, 0, 0)

Source

fn append_convenience(&self, text: Self::Cs) -> Self::E

方便 replace(length(), length(), text, 0, text.length())

Source

fn append(&self, text: Self::Cs, start: i32, end: i32) -> Self::E

方便 replace(length(), length(), text, start, end)

Source

fn append_char(&self, text: char) -> Self::E

方便 append(String.valueOf(text))

Source

fn clear(&self)

方便 replace(0, length(), “”, 0, 0). 请注意,这将清除文本,而不是跨度;如果需要,请使用 clearSpans。

Source

fn clear_spans(&self)

从可编辑对象中移除所有跨度,就像在每个跨度上调用 removeSpan 一样。

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§