Don't nest your Spinner
inside the Webview
, just give it constraints so it sits where you want.
I'm not sure if you mean you want it vertically above the WebView, or overlaid - if it's above, constrain the top of the spinner to the top of the parent, and the top of the webview to the bottom of the spinner:
<Spinner
android:id="@+id/spinner1"
...
app:layout_constraintTop_toTopOf="parent"/>
<WebView
android:id="@+id/WebView"
...
app:layout_constraintTop_toBottomOf="@id/spinner1"/>
If you want it overlaid, constrain the top of the spinner to the top of the webview, etc:
<WebView
android:id="@+id/WebView"
...
app:layout_constraintTop_toTopOf="parent"/>
<Spinner
android:id="@+id/spinner1"
...
app:layout_constraintTop_toTopOf="@id/WebView"/>
Now the spinner is relative to the WebView, and you can use margins, constraints etc to position it relative to the WebView's edges. When overlaying, order matters, but you can give it an elevation
value to explicitly move it higher, so it displays over the WebView
* Be the first to Make Comment