I want to know how to show Native ad inside webview Content at random position everytime. Suppose i am loading static html page in webview. Is it possible to show native inside webview html page at random position when user reading the content of page native ads appear inside the content.
First of all, the title of your question is really misleading, since you are really asking about dynamic positioning of a view.
Second, what you want to do is shade AF and you will probably get a lot of negative reviews and quick uninstalls. =)
That being said, the answer to your question is yes.
The easiest way to achieve this is by setting the initial Y position of the webview to 0 (at the top of the screen) and then use
View#setTranslationY with a random value, which shifts the Y position. If you really want to annoy the users you can even animate it like this:
val random = Random() val translation = random.nextInt(40) webview.animate().translationYBy(translation.toFloat()).start()