1
0

More than 1 year has passed since last update.

【Android】ボタンの上下左右に画像を動的に配置する

Posted at

リソースIDによる配置

不要な箇所は0を入れる

binding.button.setCompoundDrawablesWithIntrinsicBounds(R.drawable.image_left, R.drawable.image_top, R.drawable.image_right, R.drawable.image_bottom)

Drawableによる配置

不要な箇所はnullを入れる

val imageLeft:Drawable = //省略
val imageTop:Drawable = //省略
val imageRight:Drawable = //省略
val imageBottom:Drawable = //省略

binding.button.setCompoundDrawablesWithIntrinsicBounds( imageLeft, imageTop, imageRight, imageBottom)
1
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
1
0