android-edittext

How to make EditText hint not to wrap?

六月ゝ 毕业季﹏ 提交于 2019-12-04 02:41:26
I have a one line EditText, when I set a long hint, the hint wraps to two lines. Can I force the EditText to be always one line tall? android:lines="1" didn't work. Have you tried android:ellipsize yet? This can be set to truncate the line to end in "..." either at the start, the middle, the end, or you can set it to marquee (scroll across). Not sure offhand whether this applies to hints or not, but it should. Try android:singleLine="true" Use android:maxLines="1" or android:singleLine="true" instead of android:lines="1" 来源: https://stackoverflow.com/questions/3958138/how-to-make-edittext-hint

Android: input type for only non-numeric chars

非 Y 不嫁゛ 提交于 2019-12-04 02:29:58
问题 Hello i have an EditText on which i would like to let user enter only non-numeric chars (say A-Z or a-z): is there a way to do it? All the combinations i used (text,textPersonName an so on) let the user select also numbers. Thanks in advance c. 回答1: I think you have to write your own InputFilter and add it to the set of filters for the EditText. Something like this might work: InputFilter filter = new InputFilter() { public CharSequence filter(CharSequence source, int start, int end, Spanned

Underline under cursor

只愿长相守 提交于 2019-12-04 02:00:34
问题 I have implemented Custom edittext, with custom style : <android.support.design.widget.TextInputLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="Username" android:textColorHint="@color/white" app:hintAnimationEnabled="true" app:hintTextAppearance="@style/TExtAppearance" > <com.app.farmtrace.fieldagent.CustomView.EditText_SemiBold android:layout_width="match_parent" android:layout_height="wrap_content" android:textColor="@color/colorAccent" android

How to make Android EditText expand vertically when full

天涯浪子 提交于 2019-12-04 01:55:09
I have this EditText <EditText android:layout_width="match_parent" android:layout_height="72dp" android:hint="@string/write_message" android:textColorHint="@color/primary_color" android:ems="10" android:imeOptions="actionDone" android:inputType="textImeMultiLine" android:id="@+id/message_input" android:layout_gravity="center_horizontal" android:backgroundTint="@color/primary_color"/> When the box is filled up with user inputted text, it scrolls to the right to make room for more text, I do not like this behavior, and would prefer it if the EditText box expanded upwards when it needs more room?

How to focus on Webview upon selecting an EditText within same Layout in Android?

情到浓时终转凉″ 提交于 2019-12-04 01:46:58
问题 I have been trying to add EditTexts and WebView in a layout. The trouble is with focussing on WebView. I have tried to look through the answers on the web and Stackoverflow before deciding to ask one again. In the webview, I have some fields to fill in, which are sent via POST. If I select the Webview first (then enter the values in the field), it's fine. However, if I select the EditTexts first, I cannot focus on the Webview to fill in the fields on the webpage, although it seems that

EditText and InputFilter cause repeating text

女生的网名这么多〃 提交于 2019-12-04 01:10:26
I'm trying to implement an EditText that limits input to alpha chars only [A-Za-z]. I started with the InputFilter method from this post . When I type "a%" the text disappears then if I hit backspace the text is "a". I've tried other variations on the filter function like using a regex to match only [A-Za-z] and sometimes see crazy behavior like repeating chars, I'll type "a" then "b" and get "aab" then type "c" and get "aabaabc" then hit backspace and get "aabaabcaabaabc"! Here's the code I'm working with so far with the different approaches I've tried. EditText input = (EditText)findViewById

EditText ellipsize (three dots…)

徘徊边缘 提交于 2019-12-04 00:53:27
问题 Unfortunatelly I am not able to make ellipsize for EditText works. Is even possible to put three dots at the end of the text when the text is too long? It is working perfectly for TextiView but not for EditText. Some idea? android:id="@+id/ed_email_personalInfo" android:layout_width="match_parent" android:layout_height="55dp" android:background="@color/transparent" android:ellipsize="end" android:ems="10" android:hint="@string/email" android:inputType="textEmailAddress" android:maxLength="64"

Can't get values from Listview's EditText?

与世无争的帅哥 提交于 2019-12-04 00:27:32
问题 I'm trying to get data from EditText which is in my Listview. I saw a lot of similar questions & got a solution. But it throws an NPE in my Implementation. So please guide me to fix this issue. Adapter public class Coscho_adapter extends BaseAdapter { Context con; ArrayList<HashMap<String, String>> list; LayoutInflater mInflater; EditText marks; TextView studname, acname; public Coscho_adapter(Context co, ArrayList<HashMap<String, String>> list1) { list = list1; con = co; mInflater =

How to get elements(findViewById) for a layout which is dynamically loaded(setView) in a dialog?

孤街浪徒 提交于 2019-12-03 23:51:51
I need to get the EditText that's defined in an xml layout which is dynamically loaded as a view in a preference dialog i.e. : public class ReportBugPreference extends EditTextPreference { @Override protected void onPrepareDialogBuilder(AlertDialog.Builder builder) { super.onPrepareDialogBuilder(builder); builder.setView(LayoutInflater.from(ctx).inflate(R.layout.preference_report_bug_layout,null)); EditText edttxtBugDesc = (EditText) findViewById(R.id.bug_description_edittext); // NOT WORKING } } EDIT : SOLUTION by jjnFord @Override protected void onPrepareDialogBuilder(AlertDialog.Builder

InputFilter on EditText cause repeating text

99封情书 提交于 2019-12-03 23:28:31
I'm trying to implement an EditText that limits input to Capital chars only [A-Z0-9] with digits as well. I started with the InputFilter method from some post.But here I am getting one problem on Samsung Galaxy Tab 2 but not in emulator or Nexus 4. Problem is like this : When I type "A" the text shows as "A" its good Now when I type "B" so text should be "AB" but it gives me "AAB" this looks very Strange. In short it repeats chars Here's the code I'm working with this code : public class DemoFilter implements InputFilter { public CharSequence filter(CharSequence source, int start, int end,