Stay organized with collections
Save and categorize content based on your preferences.
open class SingleLineTransformationMethod : ReplacementTransformationMethod
This transformation method causes any newline characters (\n) to be displayed as spaces instead of causing line breaks, and causes carriage return characters (\r) to have no appearance.
Summary
Protected methods |
open CharArray! |
The characters to be replaced are \n and \r.
|
open CharArray! |
The character \n is replaced with is space; the character \r is replaced with is FEFF (zero width space).
|
Public constructors
SingleLineTransformationMethod()
Public methods
Protected methods
getOriginal
protected open fun getOriginal(): CharArray!
The characters to be replaced are \n and \r.
getReplacement
protected open fun getReplacement(): CharArray!
The character \n is replaced with is space; the character \r is replaced with is FEFF (zero width space).
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[null,null,["Last updated 2025-02-10 UTC."],[],[],null,["# SingleLineTransformationMethod\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nSingleLineTransformationMethod\n==============================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/text/method/SingleLineTransformationMethod \"View this page in Java\") \n\n```\nopen class SingleLineTransformationMethod : ReplacementTransformationMethod\n```\n\n|---|---|---------------------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) |||\n| ↳ | [android.text.method.ReplacementTransformationMethod](/reference/kotlin/android/text/method/ReplacementTransformationMethod) ||\n| | ↳ | [android.text.method.SingleLineTransformationMethod](#) |\n\nThis transformation method causes any newline characters (\\\\n) to be displayed as spaces instead of causing line breaks, and causes carriage return characters (\\\\r) to have no appearance.\n\nSummary\n-------\n\n| Public constructors ||\n|--------------------------------------------------------------------------------|---|\n| [SingleLineTransformationMethod](#SingleLineTransformationMethod())`()` \u003cbr /\u003e |\n\n| Public methods ||\n|--------------------------------------------------|------------------------------------------|\n| open static [SingleLineTransformationMethod](#)! | [getInstance](#getInstance())`()` \u003cbr /\u003e |\n\n| Protected methods ||\n|-----------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------|\n| open [CharArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-array/index.html)! | [getOriginal](#getOriginal())`()` The characters to be replaced are \\\\n and \\\\r. |\n| open [CharArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-array/index.html)! | [getReplacement](#getReplacement())`()` The character \\\\n is replaced with is space; the character \\\\r is replaced with is FEFF (zero width space). |\n\n| Inherited functions ||\n|---|---|\n| From class [ReplacementTransformationMethod](/reference/kotlin/android/text/method/ReplacementTransformationMethod) |------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [CharSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html)! | [getTransformation](/reference/kotlin/android/text/method/ReplacementTransformationMethod#getTransformation(kotlin.CharSequence,%20android.view.View))`(`source:` `[CharSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html)!`, `v:` `[View](../../view/View.html#)!`)` Returns a CharSequence that will mirror the contents of the source CharSequence but with the characters in [getOriginal](/reference/kotlin/android/text/method/ReplacementTransformationMethod#getOriginal()) replaced by ones from [getReplacement](/reference/kotlin/android/text/method/ReplacementTransformationMethod#getReplacement()). \u003cbr /\u003e | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onFocusChanged](/reference/kotlin/android/text/method/ReplacementTransformationMethod#onFocusChanged(android.view.View,%20kotlin.CharSequence,%20kotlin.Boolean,%20kotlin.Int,%20android.graphics.Rect))`(`view:` `[View](../../view/View.html#)!`, `sourceText:` `[CharSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html)!`, `focused:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`, `direction:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `previouslyFocusedRect:` `[Rect](../../graphics/Rect.html#)!`)` \u003cbr /\u003e | ||\n\nPublic constructors\n-------------------\n\n### SingleLineTransformationMethod\n\n```\nSingleLineTransformationMethod()\n```\n\nPublic methods\n--------------\n\n### getInstance\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen static fun getInstance(): SingleLineTransformationMethod!\n```\n\nProtected methods\n-----------------\n\n### getOriginal\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nprotected open fun getOriginal(): CharArray!\n```\n\nThe characters to be replaced are \\\\n and \\\\r. \n\n### getReplacement\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nprotected open fun getReplacement(): CharArray!\n```\n\nThe character \\\\n is replaced with is space; the character \\\\r is replaced with is FEFF (zero width space)."]]