java - How to enlarge edittext when focussed. (like google chrome url field) -
how can enlarge edittext when being focussed , default when unfoccused. (like google chrome url field)
the edittext @+id/edittext
here code: --custom_actionbar--
<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="50dp"> <edittext android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/edittext" android:hint="@string/url" android:inputtype="text|textnosuggestions" android:imeoptions="flagnoextractui|actionsend" android:selectallonfocus="true" android:background="#ffe0e0e0" android:layout_centervertical="true" android:layout_alignparentleft="true" android:layout_alignparentstart="true" android:layout_toleftof="@+id/imagebutton" android:layout_tostartof="@+id/imagebutton" android:padding="4dp" /> <imagebutton android:id="@+id/imagebutton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@null" android:src="@drawable/ic_action_refresh" android:layout_centervertical="true" /> <progressbar style="?android:attr/progressbarstylehorizontal" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/progressbar" android:layout_alignparentbottom="true" android:layout_below="@+id/edittext" android:layout_alignparentleft="true" android:layout_alignparentstart="true" android:layout_toleftof="@+id/imagebutton" android:layout_tostartof="@+id/imagebutton" /> </relativelayout>
get reference edit text in activity , apply focus listener :
define normal , large 2 text sizes
edit_text = (edittext) findviewbyid(r.id.edittext); edit_text.setonfocuschangelistener(new onfocuschangelistener() { @override public void onfocuschange(view v, boolean hasfocus) { if(hasfocus){ this.settextsize(large); }else { this.settextsize(normal); } } });
Comments
Post a Comment