android-edittext

How to combine input fiters for numberdecimal EditText?

佐手、 提交于 2019-12-12 03:47:44
问题 I have an app with single numberdecimal EditText . I have done 2 input filters for that EditText. I want to combine these input filters, because one of them isn't working: I want to make that the user cannot enter a value greater than 120.0 . Example: User can input 1, 2.3, 23, 45.7, 89.6, 119.9, 120.0 etc. User can't input 3.34, 45.76, 89.652, 120.00, 121.00 etc. But this code allow user to enter as many digits before decimal point, as he want:( Code of my input filters: editText.setFilters

I used Floating Labels for EditText. it's works fine in Marshmallow & Lollipop. But it's does not working In kitkat(API 19) and below API level

岁酱吖の 提交于 2019-12-12 03:46:46
问题 For Floating Editext labels my dependency in gradle is: compile 'com.android.support:design:23.2.1' what should I do? 回答1: Because you are using Material Design library as - com.android.support:design. Google introduces material design language for Lollipop (API 21) and above. So for below API 21, it will not support. You will not get same features and UI components in KITKAT. 来源: https://stackoverflow.com/questions/38013163/i-used-floating-labels-for-edittext-its-works-fine-in-marshmallow

How do I layout two EditTexts side by side to each other in a GridLayout?

社会主义新天地 提交于 2019-12-12 03:39:24
问题 I have two EditTexts. I'd like each to take up half of the UI screen width. Below is my xml layout file. Only the leftmost EditText ("Due Date") is showing so I'm clearing missing something here. The rightmost EditText that should be showing is the "Due Time". Please advise. .... <android.support.design.widget.TextInputLayout android:id="@+id/DueDate_text_input_layout" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_row="4" android:layout_column="0">

Keyboard hides EditText when selected

别来无恙 提交于 2019-12-12 03:17:25
问题 I am facing an issue where the keyboard hides an editText when the editText is selected for the second time, the first time editText is selected the keyboard behaves as expected. The issue only occurs when I set the editText input type to "NumberDecimal" but when it's set to "Default" the keyboard behaves normally as well. I have tried the following without success: android:windowSoftInputMode=“adjustResize" below is a snippet from the layout file <LinearLayout android:layout_width="match

Transfer content from EditText to another activity on buttonclick

ⅰ亾dé卋堺 提交于 2019-12-12 03:11:44
问题 I need to transfer the contents of an EditText to another activity on Button click. This is my current code for start of new activity: Button proceed; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.intro); proceed = (Button) findViewById(R.id.bProceed); proceed.setOnClickListener(new OnClickListener() { public void onClick(View v) { Intent myIntent = new Intent(Introscreen.this,

Enter character immediately after entering first character in android

时间秒杀一切 提交于 2019-12-12 03:07:39
问题 I am having a editText and inputType as phone number. I would like add specific area code immediately after I enter first digit. Say for example I enter 6 the EditText should show up +1 6. I am trying achieve this using textWatcher but not sure how to put the number that I type after "+1" public void afterTextChanged(Editable s) { if(s.length() == 1) { numberText.settext("+1"); numberText.setSelection(numberText.getText().length()); } } But the problem here is that when I enter first number

Check if EditText input matches SimpleDateFormat Android

走远了吗. 提交于 2019-12-12 03:03:33
问题 I've searched a lot about this but I didn't find a way to check if a text written by the user in an EditText matches a SimpleDateFormat, is there a simple way to do that without using regex ? Here is my SimpleDateFormat : SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); And I want to test if a String respects that format. 回答1: You may use a TextWatcher to listen input changes to your EditText and may perform appropriate actions in either of its provided method.

Android setEllipsize not working on class that extends EditText

南笙酒味 提交于 2019-12-12 02:55:55
问题 I have a class that extends EditText, on this class i'm trying to make the text to set setEllipsize when the text is to long. For some reason all my tryies didn't work. It seems that that i can scroll the text horizontal inside the text view... Can anybody advice how to make it work. (So far i've tryed many combination of those functions and that's my part in the code: public class LMEditTextAutoSize extends EditText { private boolean autoSize; public LMEditTextAutoSize(Context context,

How to get multiple variables from one EditText?

不问归期 提交于 2019-12-12 02:54:39
问题 I'm looking for a way to get three float values from one EditText.I've Looked of the developers page but i couldnt find anything that best fit my need.I would like to get three floats a x,y,z from one entry of EditText? Thank you guys so much on the replys o this Question im really greatfull. Im limited to the time on my computer right now but ill let you know which answer work for me and ill post my code too. 回答1: String value = yourEditText.getText().toString(); String[] floatStrings =

fragment - EditText.setText(String) not working when string comes from savedInstanceState but works when hard coded

元气小坏坏 提交于 2019-12-12 02:49:38
问题 I have a fragment: ContactUsFragment.java import android.app.Activity; import android.content.Context; import android.net.Uri; import android.os.Bundle; import android.app.Fragment; import android.support.design.widget.TextInputLayout; import android.text.Editable; import android.text.TextUtils; import android.text.TextWatcher; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.EditText; import android.widget.Toast; /** * */