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?

More than 1 year has passed since last update.

「Composeの基本レイアウト」のメモ#5 ~Favorite collection カードの実装~

0
Last updated at Posted at 2024-07-15

6. Favorite collection カード - マテリアル サーフェス

  • カスタマイズ性の高いカードを作成するので、Surface コンポーザブルを使用して作成する
  • 画像と文字列を横並びで設定するので、以下の構成となる
  • Surface()
    • Row()
      • Image()
      • Text()

最小構成

@Composable
fun FavoriteCollectionCard(
    modifier: Modifier = Modifier
){
    Row(
        modifier
    ) {
        Image(
            painter = painterResource(R.drawable.),
            contentDescription = null
        )
        Text(
            text = stringResource(R.string)
        )
    }
}

Imageコンポーザブルの微調整

Imageコンポーザブルの調整パラメータと同様に、contentScaleModifier.sizeで画像を調整する。

Rowコンポーザブルの微調整

Textコンポーザブルの微調整

  • 左右にpaddhingを追加して位置を調整する
    • modifier = Modifier.padding(horizontal = 16.dp)
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?