0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

JetCompose Buttonをコピペで使う

Last updated at Posted at 2025-05-15

どんなボタンがあったかな?って時に

コピペで使えるシリーズの記事を書いてみようかと、思ったので投稿しました。

まず、画像を確認して、下にコードがあるのでコピペ

スクリーンショット 2025-05-15 11.29.59.png

Filled Button (塗りつぶしボタン)

@Composable
fun MyFilledButton() {
    Button(onClick = { /* ボタンがクリックされた時の処理 */ }) {
        Text("送信")
    }
}

Filled Tonal Button (塗りつぶしトーナルボタン)

@Composable
fun MyFilledTonalButton() {
    FilledTonalButton(onClick = { /* ボタンがクリックされた時の処理 */ }) {
        Text("保存")
    }
}

Elevated Button (隆起ボタン)

@Composable
fun MyElevatedButton() {
    ElevatedButton(onClick = { /* ボタンがクリックされた時の処理 */ }) {
        Text("もっと見る")
    }
}

Outlined Button (アウトラインボタン)

@Composable
fun MyOutlinedButton() {
    OutlinedButton(onClick = { /* ボタンがクリックされた時の処理 */ }) {
        Text("キャンセル")
    }
}

Text Button (テキストボタン)

@Composable
fun MyTextButton() {
    TextButton(onClick = { /* ボタンがクリックされた時の処理 */ }) {
        Text("同意する")
    }
}

カスタムボタン

@Composable
fun MyCustomButton() {
    Button(
        onClick = { /* ボタンがクリックされた時の処理 */ },
        modifier = Modifier
            .fillMaxWidth() // 親の幅いっぱいに広げる
            .padding(16.dp) // 上下左右に 16dp のパディングを追加
    ) {
        Text("カスタムボタン")
    }
}
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?