0

を使用して、レイアウトの一部を正常に非表示にしました

    activityRootView = findViewById(R.id.bottom_layout);    
    activityRootView.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
        @Override
        public void onGlobalLayout() {
            int heightDiff = activityRootView.getRootView().getHeight() - activityRootView.getHeight();
           System.out.println("Height: "+heightDiff);

            if (heightDiff > 100) { // if more than 100 pixels, its probably a keyboard...

            RelativeLayout bottom = (RelativeLayout)findViewById(R.id.bottom_layout);
            bottom.setVisibility(View.GONE);

            }else {

                RelativeLayout bottom = (RelativeLayout)findViewById(R.id.bottom_layout);
                bottom.setVisibility(View.VISIBLE);
            }
         }
    });
4

2 に答える 2

2

これを試してみてください

  @Override
    public void onBackPressed() {
        // TODO Auto-generated method stub
        super.onBackPressed();
           button.setVisibility(View.VISIBLE);
          imageview.setVisibility(View.VISIBLE);
        InputMethodManager inputMethodManager = (InputMethodManager)  this.getSystemService(Activity.INPUT_METHOD_SERVICE);
        inputMethodManager.hideSoftInputFromWindow(this.getCurrentFocus().getWindowToken(), 0);
    }
于 2013-06-14T09:28:39.863 に答える