[android-beginners] Re: How to build EditText view like that in Android Market where X button appears for clearing text?

2009-11-08 Thread westmeadboy
I've just been playing around with this solution and it works, sort of, but feels a little hacky. I was wondering if this alternative might work: 1. Use a LinearLayout and set the background to be the same StateListDrawable used by EditText - I can't get this to work, but then again I'm a newbie

[android-beginners] Re: How to build EditText view like that in Android Market where X button appears for clearing text?

2009-09-28 Thread mjc147
To answer my own question... Use TextView.setCompoundDrawables(null, null, null, null) to hide the cross. Next thing is to detect when the cross is pressed on. Currently I do this: mEditText.setOnTouchListener(new OnTouchListener() { public boolean onTouch(View v, MotionEvent event) {

[android-beginners] Re: How to build EditText view like that in Android Market where X button appears for clearing text?

2009-09-28 Thread Mark Murphy
mjc147 wrote: To answer my own question... Use TextView.setCompoundDrawables(null, null, null, null) to hide the cross. Next thing is to detect when the cross is pressed on. Currently I do this: mEditText.setOnTouchListener(new OnTouchListener() { public boolean onTouch(View

[android-beginners] Re: How to build EditText view like that in Android Market where X button appears for clearing text?

2009-09-28 Thread mjc147
I'll refrain from saying Wow, thanks Mark! because you probably get that all the time :) I just looked at a bunch of apps that came with the Hero and the only one other than the Market using this cross, is Google Maps. I couldn't see anything like that in Internet, People, Mail, Google Talk or

[android-beginners] Re: How to build EditText view like that in Android Market where X button appears for clearing text?

2009-09-28 Thread Mark Murphy
mjc147 wrote: I'll refrain from saying Wow, thanks Mark! because you probably get that all the time :) That depends on whether what I'm saying is what somebody wants to hear. But, thanks! I just looked at a bunch of apps that came with the Hero and the only one other than the Market using

[android-beginners] Re: How to build EditText view like that in Android Market where X button appears for clearing text?

2009-09-27 Thread Mark Murphy
mjc147 wrote: I want to build a very simple view which looks exactly like the top section of the Android Market search activity (i.e. search EditText view and search button). Ideally I'd like it to look EXACTLY the same. Maybe there is some layout XML and/or code I can reuse? The Android

[android-beginners] Re: How to build EditText view like that in Android Market where X button appears for clearing text?

2009-09-27 Thread Jack Ha
Try: Drawable x = getResources().getDrawable(R.drawable.x); x.setBounds(0, 0, x.getIntrinsicWidth(), x.getIntrinsicHeight()); mEditText.setCompoundDrawables(null, null, x, null); -- Jack Ha Open Source Development Center ・T・ ・ ・Mobile・ stick together The coverage you need at the

[android-beginners] Re: How to build EditText view like that in Android Market where X button appears for clearing text?

2009-09-27 Thread mjc147
On Sep 27, 10:37 pm, Mark Murphy mmur...@commonsware.com wrote: Could you perhaps post a screenshot somewhere? Hi Mark - here is the screenshot (taken from my HTC Hero): http://www.mediafire.com/?sharekey=e574c08de66edfe8c79b87b207592a1ce04e75f6e8ebb871

[android-beginners] Re: How to build EditText view like that in Android Market where X button appears for clearing text?

2009-09-27 Thread mjc147
On Sep 28, 12:43 am, Jack Ha jack...@t-mobile.com wrote:     Drawable x = getResources().getDrawable(R.drawable.x);     x.setBounds(0, 0, x.getIntrinsicWidth(), x.getIntrinsicHeight());     mEditText.setCompoundDrawables(null, null, x, null); Thanks Jack - visually, that works exactly as I