alexa
Facebook
Twitter
LinkedIn
Instagram
Whatsapp
Call Now
Quick Inquiry

How can i place my Spinner(DropDown) on top of a WebView in Kotlin Android ?

How can i place my Spinner(DropDown) on top of a WebView in Kotlin Android ?

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


228 0
7

Write a Comments


* Be the first to Make Comment

GoodFirms Badge
GoodFirms Badge

Fix Your Meeting With Our SEO Consultants in India To Grow Your Business Online