How to set the starting position of a ScrollView?

后端 未结 6 1619
野趣味
野趣味 2021-01-07 23:36

I have been trying to set the initial position of a scroll View but have not found a way. Does anyone have any ideas? Also I have a GoogleMaps fragment as a children of the

6条回答
  •  死守一世寂寞
    2021-01-08 00:10

    None of the answers worked for me. My ScrollView is part of a surrounding LinearLayout. I put the adjustment of the ScrollView into the onDraw() method of this LinearLayout like this:

    @Override
    protected void onDraw(Canvas canvas){
        if(scrollAdjustTries > 2){
            return;
        }
        scrollAdjustTries++;
        mScrollView.scrollTo(0, mModel.scrollLine());
    }
    

    Very ugly, but working.

提交回复
热议问题