2015-06-10 64 views

回答

0
scrollView1.getViewTreeObserver().addOnScrollChangedListener(new OnScrollChangedListener() { 

     public void onScrollChanged() { 

      int scrollViewHeight = scrollView1.getChildAt(0).getHeight(); 


      Log.e("scrollVIEW_height", "SCROLL" + scrollViewHeight); 

      double size = 0; 

      DisplayMetrics dm = mContext.getResources().getDisplayMetrics(); 

      float screenWidth = dm.widthPixels/dm.xdpi; 

      float screenHeight = dm.heightPixels/dm.ydpi; 

      float i = dm.heightPixels; 

      Log.e("height in i", "" + i); 

      double heightininch = Math.sqrt(Math.pow(screenHeight, 2)); 

      Log.e("height in inch", "" + heightininch); 

      size = Math.sqrt(Math.pow(screenWidth, 2) + Math.pow(screenHeight, 2)); 

      Log.e("screen", "" + size); 

      if (size >= 6) { 

      if (scrollViewHeight >= (int)i) { 

       DownIndicator.setVisibility(View.VISIBLE); 

       // TopIndicator.setVisibility(View.VISIBLE); 

      } 
      } 
     } 
    });