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?

【Jetpack Compose】Material3でDividerが非推奨 対応方法

Posted at

Jetpack Compose 1.2.0 以降(特に Material3 モジュール)では、Dividerが明示的な方向を持つコンポーネントに分割されました。

対応方法

HorizontalDivider に書き換える

Before

.kt
Divider(
    color = Color.Gray,
    thickness = 1.dp
)

After

.kt
import androidx.compose.material3.HorizontalDivider

HorizontalDivider(
    thickness = 1.dp,
    color = Color.Gray
)

Jetpack Compose は進化が早いためMaterial3系での移行や非推奨対応はよく出てきます。
今後も非推奨APIが増える可能性があるので、@Deprecatedに惑わされずに適切なアップデートを心がけましょう!

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?