How to wrap the height of a ViewPager to the height of its current Fragment?

前端 未结 6 1536
轻奢々
轻奢々 2020-11-27 14:04

I made a ScrollView containing a ViewPager, but the ViewPager does not grow in height. When the content inside the ViewPager is too big, it get \'pucht\'(?) inside, the tabl

6条回答
  •  孤独总比滥情好
    2020-11-27 14:36

    On Android 8.0, you have to invoke another requestLayout to make it work:

    ....@Abhishek's answer
    
    sharePager.post(new Runnable() {
                @Override
                public void run() {
                    sharePager.requestLayout();
                }
            });
    

提交回复
热议问题