mardi 4 août 2015

scroll view content size

I have a ScrollView and I set a large image of tree on ScrollView and set the 15 ImageView of every branch using RelativeLayout.

My problem is when getting image only 10 then ImageView should only visible 10 and other 5 should be hide. 1 to 10 image view should display bottom of screen one by one and scroll view only scroll up should not down after 10 image view.

Right now for example, if get 8 for 8 ImageViews display in bottom of screen and if get 6 for 6 image view display in bottom and after all 7th 8th is hidden in bottom of screen but its is scrolling. which must be stop.

Here is my code:

    Display display = getWindowManager().getDefaultDisplay();
    final int height = display.getHeight();  //get screen height 
    // Log.e("width , hight od screen",""+height);
    Rect r=locateView(finalViewList.get(finalViewList.size()-1)); // get               image position on scroll view
    final int touchY = (r.bottom);
    lastPos = touchY - height;  //
    scview.scrollTo(0, lastPos); //set scroll view

Scroll is set in bottom starting from 10th ImageView but ScrollView is scrolling down and can show empty 11th image view. Suppose I hide eleven ImageViews then the empty branch is showing, which should not show.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire