Stay organized with collections
Save and categorize content based on your preferences.
abstract class ReplacementTransformationMethod : TransformationMethod
Known Direct Subclasses
HideReturnsTransformationMethod |
This transformation method causes any carriage return characters (\r) to be hidden by displaying them as zero-width non-breaking space characters (\uFEFF).
|
SingleLineTransformationMethod |
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.
|
|
This transformation method causes the characters in the getOriginal
array to be replaced by the corresponding characters in the getReplacement
array.
Summary
Protected methods |
abstract CharArray! |
Returns the list of characters that are to be replaced by other characters when displayed.
|
abstract CharArray! |
Returns a parallel array of replacement characters for the ones that are to be replaced.
|
Public constructors
ReplacementTransformationMethod()
Public methods
Protected methods
getOriginal
protected abstract fun getOriginal(): CharArray!
Returns the list of characters that are to be replaced by other characters when displayed.
getReplacement
protected abstract fun getReplacement(): CharArray!
Returns a parallel array of replacement characters for the ones that are to be replaced.
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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# ReplacementTransformationMethod\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nReplacementTransformationMethod\n===============================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/text/method/ReplacementTransformationMethod \"View this page in Java\") \n\n```\nabstract class ReplacementTransformationMethod : TransformationMethod\n```\n\n|---|----------------------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.text.method.ReplacementTransformationMethod](#) |\n\n|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Known Direct Subclasses [HideReturnsTransformationMethod](/reference/kotlin/android/text/method/HideReturnsTransformationMethod), [SingleLineTransformationMethod](/reference/kotlin/android/text/method/SingleLineTransformationMethod) |----------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [HideReturnsTransformationMethod](/reference/kotlin/android/text/method/HideReturnsTransformationMethod) | This transformation method causes any carriage return characters (\\\\r) to be hidden by displaying them as zero-width non-breaking space characters (\\\\uFEFF). | | [SingleLineTransformationMethod](/reference/kotlin/android/text/method/SingleLineTransformationMethod) | 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. | |\n\nThis transformation method causes the characters in the [getOriginal](#getOriginal()) array to be replaced by the corresponding characters in the [getReplacement](#getReplacement()) array.\n\nSummary\n-------\n\n| Public constructors ||\n|----------------------------------------------------------------------------------|---|\n| [ReplacementTransformationMethod](#ReplacementTransformationMethod())`()` \u003cbr /\u003e |\n\n| Public methods ||\n|-----------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| open [CharSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html)! | [getTransformation](#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](#getOriginal()) replaced by ones from [getReplacement](#getReplacement()). |\n| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onFocusChanged](#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\n| Protected methods ||\n|---------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------|\n| abstract [CharArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-array/index.html)! | [getOriginal](#getOriginal())`()` Returns the list of characters that are to be replaced by other characters when displayed. |\n| abstract [CharArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-array/index.html)! | [getReplacement](#getReplacement())`()` Returns a parallel array of replacement characters for the ones that are to be replaced. |\n\nPublic constructors\n-------------------\n\n### ReplacementTransformationMethod\n\n```\nReplacementTransformationMethod()\n```\n\nPublic methods\n--------------\n\n### getTransformation\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun getTransformation(\n source: CharSequence!, \n v: View!\n): CharSequence!\n```\n\nReturns a CharSequence that will mirror the contents of the source CharSequence but with the characters in [getOriginal](#getOriginal()) replaced by ones from [getReplacement](#getReplacement()). \n\n### onFocusChanged\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun onFocusChanged(\n view: View!, \n sourceText: CharSequence!, \n focused: Boolean, \n direction: Int, \n previouslyFocusedRect: Rect!\n): Unit\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 abstract fun getOriginal(): CharArray!\n```\n\nReturns the list of characters that are to be replaced by other characters when displayed. \n\n### getReplacement\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nprotected abstract fun getReplacement(): CharArray!\n```\n\nReturns a parallel array of replacement characters for the ones that are to be replaced."]]