LoginSignup
2
1

More than 1 year has passed since last update.

JetpackCompose範囲選択可能にしてコピーができるテキスト範囲選択不可能にするテキスト

Posted at

JetpackComposeで作成したテキストを範囲選択可能にしてコピーができるテキスト、範囲選択不可能にするテキストの実装方法です。

SelectableTextUnSelectableTextSample.kt
@Composable
fun SelectableTextUnSelectableTextSample() {
    SelectionContainer {
        Column {
            Text("範囲選択できるテキスト")
            DisableSelection {
                Text("範囲選択できないキスト")
            }
            Text("範囲選択できるテキスト")
        }
    }
}

SelectionContainerを使用すると選択可能になります。

DisableSelectionを使用すると選択不可能になります。

Screenshot_20221231_154438.png

以上です。

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1