0
Help us understand the problem. What are the problem?

posted at

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

リソース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)

Register as a new user and use Qiita more conveniently

  1. You can follow users and tags
  2. you can stock useful information
  3. You can make editorial suggestions for articles
What you can do with signing up
0
Help us understand the problem. What are the problem?