Compose のテキスト
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
テキストは UI の主要な構成要素です。Jetpack Compose を使用すると、テキストの表示や入力が簡単にできます。Compose では構成要素のコンポジションを利用できるため、特定のコンポーザブルの設計とロジックを意図したとおりに機能させるにあたり、プロパティやメソッドを上書きしたり、大きなクラスを拡張したりする必要はありません。
Compose には、テキストの表示とユーザー入力の処理に最低限必要な BasicText
と BasicTextField
がベースとして用意されています。その上位レベルでは、マテリアル デザイン ガイドラインに沿ったコンポーザブルである Text
と TextField
を利用できます。Android ユーザーに適した外観と操作感を提供できるほか、さまざまなコードを記述することなく簡単にカスタマイズできるオプションもあるため、これらのコンポーザブルの使用をおすすめします。
サンプル
あなたへのおすすめ
このページのコンテンツやコードサンプルは、コンテンツ ライセンスに記載のライセンスに従います。Java および OpenJDK は Oracle および関連会社の商標または登録商標です。
最終更新日 2025-07-26 UTC。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["必要な情報がない","missingTheInformationINeed","thumb-down"],["複雑すぎる / 手順が多すぎる","tooComplicatedTooManySteps","thumb-down"],["最新ではない","outOfDate","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["サンプル / コードに問題がある","samplesCodeIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-07-26 UTC。"],[],[],null,["# Text in Compose\n\nText is a central piece of any UI, and Jetpack Compose makes it easier to\ndisplay or write text. Compose leverages composition of its building blocks,\nmeaning you don't need to overwrite properties and methods or extend big classes\nto have a specific composable design and logic working the way you want.\n\nAs its base, Compose provides a [`BasicText`](/reference/kotlin/androidx/compose/foundation/text/package-summary#BasicText(androidx.compose.ui.text.AnnotatedString,androidx.compose.ui.Modifier,androidx.compose.ui.text.TextStyle,kotlin.Function1,androidx.compose.ui.text.style.TextOverflow,kotlin.Boolean,kotlin.Int,kotlin.Int,kotlin.collections.Map,androidx.compose.ui.graphics.ColorProducer))\nand [`BasicTextField`](/reference/kotlin/androidx/compose/foundation/text/package-summary#BasicTextField(androidx.compose.ui.text.input.TextFieldValue,kotlin.Function1,androidx.compose.ui.Modifier,kotlin.Boolean,kotlin.Boolean,androidx.compose.ui.text.TextStyle,androidx.compose.foundation.text.KeyboardOptions,androidx.compose.foundation.text.KeyboardActions,kotlin.Boolean,kotlin.Int,kotlin.Int,androidx.compose.ui.text.input.VisualTransformation,kotlin.Function1,androidx.compose.foundation.interaction.MutableInteractionSource,androidx.compose.ui.graphics.Brush,kotlin.Function1)),\nwhich are the barebones to display text and handle user input. At a higher\nlevel, Compose provides [`Text`](/reference/kotlin/androidx/compose/material/package-summary#Text(androidx.compose.ui.text.AnnotatedString,androidx.compose.ui.Modifier,androidx.compose.ui.graphics.Color,androidx.compose.ui.unit.TextUnit,androidx.compose.ui.text.font.FontStyle,androidx.compose.ui.text.font.FontWeight,androidx.compose.ui.text.font.FontFamily,androidx.compose.ui.unit.TextUnit,androidx.compose.ui.text.style.TextDecoration,androidx.compose.ui.text.style.TextAlign,androidx.compose.ui.unit.TextUnit,androidx.compose.ui.text.style.TextOverflow,kotlin.Boolean,kotlin.Int,kotlin.Int,kotlin.collections.Map,kotlin.Function1,androidx.compose.ui.text.TextStyle))\nand [`TextField`](/reference/kotlin/androidx/compose/material/package-summary#TextField(androidx.compose.ui.text.input.TextFieldValue,kotlin.Function1,androidx.compose.ui.Modifier,kotlin.Boolean,kotlin.Boolean,androidx.compose.ui.text.TextStyle,kotlin.Function0,kotlin.Function0,kotlin.Function0,kotlin.Function0,kotlin.Boolean,androidx.compose.ui.text.input.VisualTransformation,androidx.compose.foundation.text.KeyboardOptions,androidx.compose.foundation.text.KeyboardActions,kotlin.Boolean,kotlin.Int,kotlin.Int,androidx.compose.foundation.interaction.MutableInteractionSource,androidx.compose.ui.graphics.Shape,androidx.compose.material.TextFieldColors)),\nwhich are composables following Material Design guidelines. It's recommended to\nuse them as they have the right look and feel for users on Android, and includes\nother options to simplify their customization without having to write a lot of\ncode.\n\nSamples\n-------\n\nRecommended for you\n-------------------\n\n- Note: link text is displayed when JavaScript is off\n- [Display emoji](/develop/ui/compose/text/emoji)\n- [Custom design systems in Compose](/develop/ui/compose/designsystems/custom)\n- [Material Design 2 in Compose](/develop/ui/compose/designsystems/material)"]]