问题
This is the problem: https://imgur.com/gallery/pRFhG9e?s=wa
I already asked once (How to avoid admob adview being cut off) but didn't get any successful answers.
I have new info that I didn't provide in the previous question. I have realized that the AdView comes back to the right place after I scroll up or down the RecyclerView, so I think the problem is related to the RecyclerView somehow pushing down the AdView.
Some new solutions I have tried inside onResume and have failed:
- Use .scrollToPosition with the instance of RecyclerView.
- Use .notifyDataSetChanged with the subclass of RecyclerView.Adapter
- Call once again mRecyclerView.setAdapter(my adapter subclass)
With all these three attempts I intended to make the RecyclerView scroll without the user having to do it himself so that when he would go back he would automatically see the AdView in place again. As I said, it was a big fail.
来源:https://stackoverflow.com/questions/55050062/how-to-fix-view-that-is-misplaced-and-only-comes-to-right-place-after-i-scroll-i