3
3

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 5 years have passed since last update.

カスタムToastを表示

Posted at

TODO

  • 背景が色付き等、オリジナルのトーストを設定する

方法

MainActivity.kt
    val toast = Toast(context)
    // customViewをオリジナルのviewに設定する
    val customView = layoutInflater.inflate(R.layout.cutom_view, null)
    toast.view = customView
    // xOffset:横位置, yOffset:高さ
    // xOffset=0にし、高さだけ指定すると中央に表示される
    toast.setGravity(Gravity.BOTTOM, xOffset, yOffset)
    toast.show()
3
3
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
3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?