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?

Material 3 Expressive実装例 : Extended FAB

Last updated at Posted at 2025-06-11

Material 3 Expressive の実装例の紹介シリーズです。
今回は Extended FAB (Floating action button)を紹介します。
(androidx.compose.material3:material3:1.4.0-alpha15 時点での内容になります。)

Material 3 Expressive での変更点

  • 新たに Small、Medium、Large のサイズが登場
    • これまでの Extended FAB は非推奨になり同サイズである Small が置き換え先
  • Surface なスタイルが非推奨
  • ラベルのテキストサイズが大きくなるように調整
    • 非推奨な Extended FAB と同サイズの Small の場合 Label large から Title medium に変更されている

実装

これまでの ExtendedFloatingActionButton ではなく、それぞれのサイズ名が入った関数を使用します。

// Small
SmallExtendedFloatingActionButton(
    onClick = {},
    text = {
        Text("Edit")
    },
    icon = {
        Icon(
            painterResource(R.drawable.ic_edit),
            contentDescription = null,
        )
    }
)

// Medium
MediumExtendedFloatingActionButton(
    onClick = {},
    text = {
        Text("Edit")
    },
    icon = {
        Icon(
            painterResource(R.drawable.ic_edit),
            contentDescription = null,
            modifier = Modifier.size(FloatingActionButtonDefaults.MediumIconSize),
        )
    }
)

// Large
LargeExtendedFloatingActionButton(
    onClick = {},
    text = {
        Text("Edit")
    },
    icon = {
        Icon(
            painterResource(R.drawable.ic_edit),
            contentDescription = null,
            modifier = Modifier.size(FloatingActionButtonDefaults.LargeIconSize),
        )
    }
)
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?