android-edittext

Lollipop EditBox styling

江枫思渺然 提交于 2019-12-22 04:14:12
问题 I currently have this one: Is it possible to remove black stroke and have only highlighted? Does it violate any Google guideline about material design 回答1: It is totally an android lollipop bug. It happens to the framework and AppCompat version of the EditText and will be fixed in a future release. See here: https://code.google.com/p/android/issues/detail?id=80180 来源: https://stackoverflow.com/questions/27123278/lollipop-editbox-styling

Remove whole Spannable with backspace

拈花ヽ惹草 提交于 2019-12-22 03:57:23
问题 I have a chat application which offers the possibility to add emoticons to the text. I have a problem with the EditText field. The emoticon images show up but if I press on the normal keyboard the backspace button, the text which I was changing to an emoticons picture shows up and I have to remove several characters until the picture goes away. I am using Spannable to do this. I want the whole smilie go away if the user presses one time backspace. Here the code I am using: // This is in the

String.format uses comma instead of point

前提是你 提交于 2019-12-22 03:50:31
问题 My app is working on many devices without problems so far. But now I got my new Galaxy Tab with Android 3.2 where it crashes all the time. I found out that the problem was a float in an EditText. I am using myEditText.setText(String.format("%.1f", fMyFloat)); to put the float in the EditText. But somehow the float on my 3.2 Galaxy Tab is generated with a comma instead of a point. When I read the EditText back the app crashes of course, telling me that this is no valid float because of the

Clickable Button (or any View) inside EditText in android

杀马特。学长 韩版系。学妹 提交于 2019-12-22 03:44:54
问题 I want to have a Button or a clickable View in my EditText so that I can perform some action on click of it. I was able to put a drawable inside my EditText thanks to Marcosbeirigo for this answer. But, now I want to make it clickable so that I can perform some action on it. I know this is possible as HTC uses buttons inside EditText in their stock sms app as shown in the following image- In my case, the button will be positioned anywhere, can be in the center also. But the main thing is how

EditText - Gap between text and EditText's line

邮差的信 提交于 2019-12-22 03:36:51
问题 When I insert text to my EditText field the text has an abnormal gap between itself and the EditText 's line. Here's a printscreen from my terminal where you can see this gap I'm talking about, it is marked in red. I've played around with text alignment and gravity but to no success. Here's the XML: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent"

EditText - Gap between text and EditText's line

倾然丶 夕夏残阳落幕 提交于 2019-12-22 03:36:20
问题 When I insert text to my EditText field the text has an abnormal gap between itself and the EditText 's line. Here's a printscreen from my terminal where you can see this gap I'm talking about, it is marked in red. I've played around with text alignment and gravity but to no success. Here's the XML: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent"

How to clear the text in edittext

不打扰是莪最后的温柔 提交于 2019-12-22 03:21:04
问题 I want to clear the text in EditText after it has been saved in database. Here is my code: pictureDescription.addTextChangedListener(new TextWatcher() { public void afterTextChanged(Editable textValue) { String content = textValue.toString(); db.updatePicDes(content,lastSnapId); } } 回答1: Use editText.getText().clear() . 回答2: Just set it to empty string. I think it should do it. EditText editText = (EditText)findViewById(R.id.edit_text); editText.setText(""); 回答3: you can use EditText.setText(

Edittext values in listview changes to default on screen timeout

烂漫一生 提交于 2019-12-22 01:10:56
问题 I have a listview with edittext widgets inside each row. I use a viewholder inside my custom adapter to keep track of all the views. But my problem is that when i input a value inside my edittext , pause until my screen times out, when you unlock the phone while still in the same activity ,the default edittext value is refilled, overwriting my edits. I followed this suggestion here (when listview scroll that time edittext set default value) considering that maybe i am not using the viewholder

EditText´s android:nextFocusDown attibute stops working when onClick is set

烂漫一生 提交于 2019-12-21 22:38:51
问题 Does anybody knows why the android:nextFocusDown attibute stops working when we set the onClick on it? On the example below, we have some EditText with this attribute defined: <TableRow android:weightSum="1" android:gravity="center"> <EditText android:id="@+id/txtChave1" android:maxLength="4" android:gravity="center" android:textSize="16dp" android:layout_height="wrap_content" android:layout_weight=".23" android:layout_width="0dp" android:layout_marginLeft="5dp" android:layout_marginRight=

How to set font style of selected text using custom typeface through spannable method

若如初见. 提交于 2019-12-21 22:34:06
问题 I want to set style to selected text from EditText using custom typeface . I am getting below error at compile time. The constructor StyleSpan(Typeface) is undefined . Below code I am applying. int start=editbox.getSelectionStart(); int end=editbox.getSelectionEnd(); Spannable span=(Spannable)editbox.getText(); StyleSpan f = new StyleSpan( Typeface.createFromAsset(getAssets(), "fonts/genbkbasr.ttf")); span.setSpan(f, start,end, 0); Thanks. 回答1: I wrote a class to work around this limitation.