clearFocus in android dialog doesn't work -
i have edittext(searcfield) in android dialog, after finished editing, , dismiss dialog.
then go other edittext, focus still in searchfield.
any idea?
thanks
edit: there post in here, hope can bit understand issue.
customer dialog view
<linearlayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:paddingtop="5dip" android:orientation="horizontal" > <edittext android:id="@+id/search_field" android:layout_width="0dp" android:layout_height="wrap_content" android:gravity="left" android:inputtype="textnosuggestions|textvisiblepassword" android:layout_weight="0.70" android:hint="type item name search"/> </linearlayout> <listview android:id="@+id/itemlist" android:layout_width="fill_parent" android:layout_height="wrap_content" android:divider="#00000000" android:descendantfocusability="beforedescendants" android:scrollbars="none"/> </linearlayout>
java code
view searchview = getactivity().getlayoutinflater().inflate(r.layout.search, null, false); edittext searchfield = (edittext)producteditview.findviewbyid(r.id.search_field); searchfield.addtextchangedlistener(this); ... public void aftertextchanged(editable text) { if (searchfield.hasfocus()) { log.i("myapp", "searchfield still focused"); return; } if (otherfield.hasfocus()){ log.i("myapp", "other field"); return; } }
another, albeit hacky, solution regularly use setting android:focusable="true"
, android:focusableintouchmode="true"
parent view (linearlayout, relativelayout, etc) of layout if want able clearfocus() of edittext, or open activity/fragment without first edittext being focused automatically.
Comments
Post a Comment