android-edittext

Edittext that make selection on long click but do not show context menu?

不问归期 提交于 2019-12-01 13:15:11
问题 i want to provide custom handlers that cut,copy text. Target on Longclick Context Menu Should not appear. Text could get selected with trackers ( or Draggers ). [UPDATE] protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); edittext = (EditText) findViewById(R.id.notetext); . . . . edittext.setCustomSelectionActionModeCallback(new ActionMode.Callback() { public boolean onPrepareActionMode(ActionMode mode, Menu menu) {

ListView EditTexts values are messed up when scrolling

夙愿已清 提交于 2019-12-01 13:09:20
问题 As I mentioned in the title, the listview duplicates edittexts values for the children after i=10 in the for loop in my code. public class ExerciseAdapter extends ArrayAdapter<ExerciseSet> { private ArrayList<ExerciseSet> mExercise; private LayoutInflater inflater; private List<String> texts = new ArrayList<String>(); public ExerciseAdapter(Context context, int textViewResourceId, ArrayList<ExerciseSet> objects) { super(context, textViewResourceId, objects); mExercise = objects; inflater =

How to get values from dynamically created EditText fields?

一笑奈何 提交于 2019-12-01 13:04:39
问题 I am little confused with following scenario: I have an add button which I use it to add a number of EditText fields, when I tap on the save button I should get the values from the EditText s. How can I get these values from all of the EditText fields? 回答1: You could do something like this: Store all the EditText fields you create programmatically inside a List. So whenever you have viewGroup.add(myEditText); you would also have myList.add(myEditText); Then when you press 'save' just loop on

Rounded rectangle background editext with hint in left top of background border

半腔热情 提交于 2019-12-01 12:58:28
I got stuck in creating UI. please help me out creating that . I have a EditText having rounded rectangle border which is ok but placeholder is in the top of border leaving the border. Here is the image Thanks in advance. You have to use Vector Drawable for creating custom shape as you need. I have created a sample for the same. Create custom_vector.xml file under res/drawable/ <vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="20dp" android:width="20dp" android:viewportWidth="400" android:viewportHeight="400"> <group android:pivotX="10.0" android:pivotY="10.0">

Android Text Input Special UI Item

杀马特。学长 韩版系。学妹 提交于 2019-12-01 12:37:40
问题 I'm creating an IM client/server application for the Android OS, and am currently putting together the user interface. Right now, my interface consists of a EditText element, and a Button element. When I tap on the EditText element, a keyboard pops up and allows you to type. What I would like to have is something like the text entry area and send button in the default Android SMS app. Something like this: The text input field and Send button would stay at the bottom of the screen, and when

Validate date in edittext box

感情迁移 提交于 2019-12-01 12:32:44
问题 I am using the following code to validate date entered in edittextbox.however in xml file I had given its input type date. int i = validate(registerdate); this is validate function: private int validate(String registerdate) { String regEx = "^(0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])[- /.](19|20)\d\d$"; Matcher matcherObj = Pattern.compile(regEx).matcher(registerdate); if (matcherObj.matches()) { return 1; } else { return 0; } } its giving me compile time error at String regEx = "^(0[1-9]

How to enable keyboard on touch after disabling it with setTextIsSelectable

萝らか妹 提交于 2019-12-01 12:19:05
I am using a custom in-app keyboard , so I need to disable the system keyboard. I can do that with editText.setShowSoftInputOnFocus(false); for Android API 21+. But to do the same thing down to API 11, I am doing editText.setTextIsSelectable(true); Sometimes I want to show the system keyboard again after disabling it with setTextIsSelectable . But I can't figure out how. Doing the following does show the system keyboard, but if the user hides the keyboard and then clicks the EditText again, the keyboard still won't show. InputMethodManager imm = (InputMethodManager) getSystemService(Context

How to use ruled/horizontal lines to align text in EditText in Android?

冷暖自知 提交于 2019-12-01 11:43:49
Basically I want to do something like this in Android: I am trying to draw horizontal lines in a custom EditText , and then typing on these lines. I am using the text size for the distance between two horizontal lines . However, the size of cursor and that of text is not same . Hence, I am not able to maintain placing text "on" these lines. The alignment of the text base to these horizontal lines are not coming as proper. Here is the code used for drawing the lines:- float textSize = getTextSize()); Paint paint = new Paint(); for (int i = 0; i < 50; i++) { canvas.drawLine(0, textSize * i,

Multiautocompletetextview, Show autocomplete drop down only when user presses a key after '@' key (like mention in FB app)

僤鯓⒐⒋嵵緔 提交于 2019-12-01 11:37:08
I got it working with custom '@' tokenizer. But it fails for the first autocompletion. My code works as a comma tokenizer where I get suggestion for any character and next suggestion only after a comma(it's '@' in my case). Here's my code. String[] str={"Andoid","Jelly Bean","Froyo", "Ginger Bread","Eclipse Indigo","Eclipse Juno"}; editEmojicon.setTokenizer(new MultiAutoCompleteTextView.Tokenizer() { @Override public int findTokenStart(CharSequence text, int cursor) { int i = cursor; while (i > 0 && text.charAt(i - 1) != '@') { i--; } while (i < cursor && text.charAt(i) == ' ') { i++; } return

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

心不动则不痛 提交于 2019-12-01 11:03:56
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 another cursor is setup in parallel to the one in the EditText section. The resulting webpage contains some