1

I would like to imitate the behavior of the default android browser - The EditText (the address bar) on top will start to "disappear" once the user scrolls down. The only thing I can think of right now is to put the EditText and the WebView in a ScrollView but that would create other problems, and is not recommended.

What do you think?

2 Answers 2

0

Create a custom View by extending WebView and override onScrollChanged(). With a little calculations you can accomplish your task.

Sign up to request clarification or add additional context in comments.

2 Comments

So basically what you are saying is that I will have to "push" the address bar out of the bounds of the screen? Isn't there any "elegant" way to do it?
That's what I was implying. Changing the editbox's position depending on the current scroll. Not any, that i'm aware of.
0

What problems does your ScrollView cause? This one should work fine:

<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:stretchColumns="0" android:orientation="vertical"> <ScrollView android:layout_width="fill_parent" android:layout_gravity="top" android:layout_height="fill_parent"> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:stretchColumns="0" android:orientation="vertical"> <EditText android:layout_width="fill_parent" android:id="@+id/editText1" android:text="yourtexthere" android:layout_gravity="bottom" android:layout_height="wrap_content"> </EditText> <WebView android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/myWebView"></WebView> </LinearLayout> </ScrollView> </LinearLayout> 

1 Comment

In my opinion this standalone solution provides bad user experience due to ugly scrolling of the WebView. See my answer here in order to provide better user experience while placing webview inside a scroll view - TolerantScrollView

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.