2013. 7. 8. 17:21
키보드 on/off 를 감지해서 키보드가 on 됐을때 애드몹광고를 지우고, off 됐을때 애드몹 광고를 다시 보여주는 코드임
 
		final View activityRootView = findViewById(R.id.roo_layout);
		activityRootView.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
		  @Override
		  public void onGlobalLayout() {
			  Rect r = new Rect();
			  activityRootView.getWindowVisibleDisplayFrame(r);
              int heightDiff = activityRootView.getRootView().getHeight() - (r.bottom - r.top);
              if (heightDiff > 100) {
            	  Log.d("kth", "activityRootView on");
            	  adView.setVisibility(View.GONE);
              } else {
            	  Log.d("kth", "activityRootView off");
            	  adView.setVisibility(View.VISIBLE);
              }

		  }
		});
Posted by hoonihoon