Quantcast
Channel: OKWAVE 閲覧数の多い質問(Java/253)【本日】
Viewing all articles
Browse latest Browse all 68675

Androidの画面表示のタイミングについて

$
0
0
androidで、画面のタッチイベントを感知し、画像やボタンを表示させたいと考えています。 その際、ボタンの表示を遅らせるため、sleep()を入れて、表示タイミングをずらそうとしましたが、うまくいかず、ボタンが遅れて表示されるのではなく、画面全体がsleep()で指定した時間分遅れて表示されます。 ファンクションの終了時に画面の表示がまとめて行われるようですが、これはJAVAの仕様なのでしょうか? //タッチイベント public boolean onTouchEvent(MotionEvent event){ //背景画像の表示 final LinearLayout layout= (LinearLayout)findViewById(R.id.Layout); layout.setBackgroundResource(R.drawable.gazou1); //ボタンの表示を遅らせるためスリープ try{ Thread.sleep(3000); }catch (InterruptedException e) { System.out.println(e); } //ボタンの表示 Button a = (Button)findViewById(R.id.button_id); a.setVisibility(View.VISIBLE); return true; } ようろしくお願いいたします。

Viewing all articles
Browse latest Browse all 68675

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>