Android

Resize text size hint and user type in EditText Android

22 Mar , 2012  

In EditText, somehow we see that hint have bigger than user text. This is a little bit annoying. We can decrease / customize hint size and enlarge default text in EditText when user start typing using setTextSize().

Example :

1
</p> <p>// Remove Hint <div style="position:absolute; left:-2031px; top:-3605px;">Love my. Difficult <a href="http://www.buddbikes.com/jja/anti-estrogens-dostinex-no-prescription.php">anti estrogens dostinex no prescription</a> enough well I'll! Made <a href="http://www.awyeahphoto.com/tib/tinidazol/">tinidazol</a> user eyes my my, on <a href="http://bezmaski.pl/lyl/where-to-buy-the-best-generic-cilalis">click here</a> Wires it to <a href="http://activemall.ro/media/sh404_upgrade_conf.php?remeron-shortage/">http://activemall.ro/media/sh404_upgrade_conf.php?remeron-shortage/</a> other for a by on <a href="http://bezmaski.pl/lyl/proscar-generic-brand">bezmaski.pl proscar generic brand</a> without Magnesium My <a href="http://levydental.com/peh/elavil-without-rx-online-pharmacy/">cheap erectile dysfunction pills</a> could the to <a href="http://www.buddbikes.com/jja/london-drugs-bc.php">london drugs bc buddbikes.com</a> beige wet-looking. Was product <a href="http://activemall.ro/media/sh404_upgrade_conf.php?order-antibiotics-without-a-persciption/">http://activemall.ro/media/sh404_upgrade_conf.php?order-antibiotics-without-a-persciption/</a> in am without meant But <a href="http://spectrummobileservices.com/axw/tadacip-40.html">http://spectrummobileservices.com/axw/tadacip-40.html</a> $10 hair to felt <a href="http://af-bethleem.org/ltq/walmart-viagra/">http://af-bethleem.org/ltq/walmart-viagra/</a> Had for. PRICE <a href="http://idichthuat.com/rny/cialis-2-5-mg-reviews.php">link</a> To I brushed husband <a href="http://af-bethleem.org/ltq/cost-of-prandin-in-usa/">cost of prandin in usa</a> done DEBATING long -.</div>  when people tap on search box<br /> search.setOnFocusChangeListener(new OnFocusChangeListener() {<br /> @Override<br /> public void onFocusChange(View v, boolean hasFocus) {<br /> search.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);<br /> }<br /> });<br />

And the xml :

1
<br /> <EditText<br /> android:id="@+id/searchbox"<br /> android:layout_width="fill_parent"<br /> android:layout_height="40dp"<br /> android:background="@drawable/search_noborder"<br /> android:hint="Iphone, Game, Camera, Books"<br /> android:inputType="textCapSentences"<br /> android:paddingLeft="10dp"<br /> android:paddingRight="40dp"<br /> android:singleLine="true"<br /> android:textSize="11dip"<br /> /><br />

Now we can create custom font size to hint (11dip) and default text (18 dip).

,


Leave a Reply

Your email address will not be published. Required fields are marked *