0

I have an particular behavior

focus does not change from edittext to textbox of webview in android 2.2 in emulator. If I remove the edittext layout then everything works perfectly. Every textbox can be clicked and inputted with values.

If there is a edittext then focus does not shift to textbox but cursor will be there at both the webview textbox and edittext.

I have attached the image on how two cursors are coming up and when typing only the edittext gets populated.

I am also using Action Bar Sherlock.

Any help would be appreciated.

layout added

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:background="@drawable/white"
android:tileMode="repeat" >

<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout 
android:layout_height="wrap_content" 
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_marginTop="30dip">
    <EditText android:text="" 
        android:id="@+id/searchEditText"
        android:layout_height="wrap_content" 
        android:layout_weight="1"
        android:layout_width="fill_parent">
    </EditText>
    <Button android:text="Search" 
        android:id="@+id/searchCatalogButton"
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content">
    </Button>

  </LinearLayout>

<WebView
            android:id="@+id/browserwebview"
            android:fillViewport="true"
            android:layout_marginTop="75dip"
            android:layout_marginBottom="30dip"
            android:layout_height="fill_parent"
            android:layout_width="fill_parent"
            android:focusable="true"/>
    <LinearLayout
        android:id="@+id/header"
        android:layout_alignParentTop="true"
        android:layout_width="fill_parent" 
        android:layout_height="30dip"
        android:background="@drawable/black"
        android:tileMode="repeat">
        <ImageButton 
            android:id="@+id/buttonBackCatalog"
            android:src="@drawable/greenarrow"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/black"
            android:tileMode="repeat"/>
      <ImageView 
          android:src="@drawable/logo"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:visibility="gone"/>
         </LinearLayout>

                <LinearLayout
        android:layout_alignParentBottom="true"
        android:layout_width="fill_parent" 
        android:layout_height="30dip"
        android:layout_weight="1"
        android:weightSum="5" 
        android:orientation="horizontal"
        android:background="@drawable/black"
        android:tileMode="repeat">

    <LinearLayout 
        android:id="@+id/footerLayoutHome"
        android:clickable="true"
        android:layout_width="fill_parent"
        android:layout_weight="1" 
        android:orientation="vertical"
        android:gravity="center" 
        android:layout_height="fill_parent">

        <ImageButton 
            android:id="@+id/footerMainBtnHome"
            android:layout_width="fill_parent" 
            android:layout_height="14dip"
            android:src="@drawable/home" 
            android:background="@drawable/black"/>
        <TextView 
            android:text="Home" 
            android:textSize="8dip"
            android:textColor="#ffffff"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
    </LinearLayout>
     <LinearLayout 
         android:id="@+id/footerLayoutProducts"
         android:clickable="true"
        android:layout_width="fill_parent"
        android:layout_weight="1" 
        android:orientation="vertical"
        android:gravity="center" 
        android:layout_height="fill_parent">

        <ImageButton 
            android:id="@+id/footerMainBtnProducts"
            android:layout_width="fill_parent" 
            android:layout_height="14dip"
            android:src="@drawable/products" 
            android:background="@drawable/black"/> 
            <TextView 
            android:text="Products" 
            android:textSize="8dip"
            android:textColor="#ffffff"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
    </LinearLayout>
     <LinearLayout 
         android:id="@+id/footerLayoutCart"
         android:clickable="true"
        android:layout_width="fill_parent"
        android:layout_weight="1" 
        android:orientation="vertical"
        android:gravity="center" 
        android:layout_height="fill_parent">

        <ImageButton 
            android:id="@+id/footerMainBtnCart"
            android:layout_width="fill_parent" 
            android:layout_height="14dip"
            android:src="@drawable/cart" 
            android:background="@drawable/black"/>
        <TextView 
            android:text="Cart" 
            android:textSize="8dip"
            android:textColor="#ffffff"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />

    </LinearLayout>
     <LinearLayout 
         android:id="@+id/footerLayoutFeedback"
         android:clickable="true"
        android:layout_width="fill_parent"
        android:layout_weight="1" 
        android:orientation="vertical"
        android:gravity="center" 
        android:layout_height="fill_parent">

        <ImageButton 
            android:id="@+id/footerMainBtnFeedback"
            android:layout_width="fill_parent" 
            android:layout_height="14dip"
            android:src="@drawable/feedback" 
            android:background="@drawable/black"/>
        <TextView 
            android:text="Feedback" 
            android:textSize="8dip"
            android:textColor="#ffffff"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />

    </LinearLayout>
     <LinearLayout 
         android:id="@+id/footerLayoutHelp"
         android:clickable="true"
        android:layout_width="fill_parent"
        android:layout_weight="1" 
        android:orientation="vertical"
        android:gravity="center" 
        android:layout_height="fill_parent">

        <ImageButton 
            android:id="@+id/footerMainBtnHelp"
            android:layout_width="fill_parent" 
            android:layout_height="14dip" 
            android:src="@drawable/help" 
            android:background="@drawable/black"/>
        <TextView 
            android:text="Help" 
            android:textSize="8dip"
            android:textColor="#ffffff"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />

    </LinearLayout>



         </LinearLayout>
</RelativeLayout>
</LinearLayout>

thanks.

image attached

Mukunda
  • 1,593
  • 3
  • 26
  • 45

2 Answers2

0

Try adding

android:focusable="true"

to your WebView in layout.

anujprashar
  • 6,263
  • 7
  • 52
  • 86
  • once I click on `editext` the focus would not come again on the `textbox` in `webview`. thanks. – Mukunda Aug 06 '12 at 08:00
  • 1
    See if this answer helps http://stackoverflow.com/questions/4200259/tapping-form-field-in-webview-does-not-show-soft-keyboard. – anujprashar Aug 06 '12 at 08:08
0

try adding

above ur edit text, this make sure that edittext doeant get default focus. Edittest will then get focus only when u click on it.

If it doesnt work please provide your layout

png
  • 4,368
  • 7
  • 69
  • 118