android アプリ開発で、ImageView に設定した画像をクリアする方法です。
スポンサーリンク
ImageViewをクリアする
clear みたいなメソッドがあれば分かりやすかったんですが、そうゆうのはなく setImageDrawable メソッドの引数に null を指定することでイメージの表示をクリアできます。
【Java】
ImageView imageView = (ImageView)findViewById(R.id.imageView);
imageView.setImageDrawable(null);
【Kotlin】
var imageView = findViewById<ImageView>(R.id.imageView)
imageView.setImageDrawable(null);

0 件のコメント:
コメントを投稿