public class CustomEditText extends EditText {
//code here
}
--
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
package com.example.custom.edit.text;
import android.app.Activity;
import android.content.Context;
import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.LinearLayout;
public class CustomEditTextActivity extends
Link to pastebin http://pastebin.com/BEp4z2kb
I hope someone can help me. It seemed a trivial task when I designed my
project, but know I really can't go on. I pasted a self contained Android
activity with my custom widget. You only need to create a new Android
project with the following
Here is something I came up. I haven't worked out all the details, but maybe
this will get you started.
It works by using a RelativeLayout and when you tap on a TextView, it just
sets the bounds of an EditText to match the TextView. It then hides the
TextView and layers the EditText on the
Thanks for your reply, but in my real application I have two nested
LinearLayout which make up a table. This table is comprised of
CustomEditText, so your solution isn't appliable here. I appreciate your
effort, but I need a solution based on the above pattern. I also tried to
use a ViewSwitcher
You could still use my code but instead of using it straight, you could just
wrap it in a custom view. So instead of just a TextView or EditView, use
the above code wrapped in a custom View and have the TextView/EditView
inside it. Use the swap code there and it would actually a bit more
I can't use your code because your technique is only suitable for a
RelativeLayout. In a LinearLayout there is no way to stack views and playing
with their visibility. Of course, I could take your approach and find a way
to have a floating EditText which is exactly over the TextView (ie an
Some of the things can be done with drawable state list(s) and stuff.
The standard EditText uses a state-list drawable for its background, it
can be found under:
android-sdk\platforms\platform-X\data\drawable.
The name can be found by looking in the platform's styles.xml:
style
Hi Kostya, you must be the author of WiFi manager :) Nice to meet you
The problem here is not about visual appearance, it's about EditText
behavior :) I agree that UIs should be as intuitive as possible, so I can
make you an example of what I want to implement. Imagine to have a 7x7 table
of
Using a simple technique, and should be usable anywhere.
?xml version=1.0 encoding=utf-8?
RelativeLayout android:id=@+id/rlHolder
xmlns:android=http://schemas.android.com/apk/res/android;
android:orientation=vertical android:layout_width=match_parent
android:layout_height=match_parent
Along with the above code you could add an Ok button to the side of the
edit text to accept the input and revert back to a TextView.
Steven
Studio LFP
http://www.studio-lfp.com
On Friday, October 7, 2011 12:02:52 PM UTC-5, Studio LFP wrote:
Using a simple technique, and should be usable
I already told you that I tried a similar approach with a ViewSwitcher.
There is no need to extend a LinearLayout for this task if there is a pre
built ViewSwitcher. The problem with this pattern is that the user click is
eaten by the SwapView, so the user has to click another time in the
etNew.requestFocus();
InputMethodManager mgr = (InputMethodManager)
context.getSystemService(Context.INPUT_METHOD_SERVICE);
mgr.showSoftInput( etNew, InputMethodManager.SHOW_IMPLICIT );
There, add that to the case: TYPE_EDIT before the break and your done. And
yes, there is a reason to make
07.10.2011 21:01, Raffaele Sgarro пишет:
Hi Kostya, you must be the author of WiFi manager :) Nice to meet you
I am. Just wanted a little widget for myself, then it kind of went out
of control :)
The problem here is not about visual appearance, it's about EditText
behavior :) I agree
Sorry Steven, I didn't mean to hurt you
I appreciate your help a lot, you are the only one which actually coded
something, and I believe this is very valuable. The layout approach was my
first attempt, but I'm working on something cleaner and I think I have
finally found a solution, which I'll
Here is the whole Eclipse
projecthttp://www.2shared.com/file/us3MXMdS/custom-edit-text.html?
After more than 6 hours working on this, I finally found a solution. It's
simpler than what I thought.
The key point is using setFocusable()and setFocusableInTouchMode() at the
right moments, and manually
I'm not hurt by you choosing to go a different path. Just seems like you are
leaving a lot on the table that's already written for you by trying to put a
square peg into a round hole. I checked out that project and I think you are
cutting yourself short here because of the following:
1. Now
Unfortunately I can't give you my actual app's code, but #1 and #2 are not
issues since they are intended :)
#3 seems a bug instead. Can you please describe carefully what are the steps
to reproduce it? Also the Android runtime version could matter. I can't
reproduce that behavior. Thanks for
I tested it on the following:
Xperia Play - Android 2.3.2
Samsung Galaxy Tab (7 in) - Android 2.2
Motorola Droid (Original) - Android 2.2.2
Droid Bionic - Android 2.3.4
HTC Hero - Androi 2.1-update 1
My Xoom is out for the LTE upgrade so I can't test it on that at the moment.
It only worked
Oh my god, it's a mess!!! But still I don't understand exactly what happens.
I think you do something like
1. Long tap on a view: this shows the soft keyboard and you can type
anything
2. Click on the same view: this triggers the mess
Is this right? Is the problem when you click in the
Exactly. When I try to touch to move the cursor in an already focused box,
the keyboard dismisses on everything but the HTC Hero on 2.1-update 1. The
Xperia Play goes into some kind of select text mode the others don't.
You may have to check if the view that is clicked on is the one the user
Please, try adding this little patch at line 23
if (mLastTapped == arg0) return;
This should be enough
2011/10/7 Studio LFP studio@gmail.com
Exactly. When I try to touch to move the cursor in an already focused box,
the keyboard dismisses on everything but the HTC Hero on 2.1-update 1.
That worked for all but the Xperia Play. It still selects everything and
doesn't let me place a cursor where I want it.
You will need to clear that at some point because it prevents clicking on
the same view again. This could be bad if the phone goes to sleep or another
activity comes up and
I really cannot understand what's going on :S The XPeria is the only phone
with the hard keyword, isn't it? But if I try in the emulator (which also
emulates a hardware keyboard) everything goes fine. I mean, when you long
click a View all text is selected (intended, so one can easily erase
Ok, I played with it and got it to work.
On the Xperia Play (which has a hardware game pad not a hardware keyboard),
the problem is it starts with all the text selected so you can't touch
anywhere to move the cursor. You need to move the selection handles to
unselect part of the text and then
25 matches
Mail list logo