I have a EditText which I disabled the keyboard from popping up. And a set of buttons to enter text into the EditText with. The idea is to click a button -> enter some text into the text field.
I append the text to be input and the problem is that it just keeps appending on the same line. How can I get the text to go to a new line once we reached the end of the bounds of the text field (like how the default keyboard does)?
my edit text looks something like this:
<EditText
android:id="#+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/button1"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:inputType="textMultiLine"
android:scrollHorizontally="false"
android:gravity="top|left"
android:cursorVisible="true"
android:lines="10">
Ok I found what the problem is. I had disabled the softkeyboard by doing this:
Etext = (EditText) findViewById(R.id.editText1);
Etext.setInputType(0);
I found that when I didn't disable the softkeyboard, the multi line worked just fine.
Solution was to NOT setInputType(0) and set editable=false and inputType=none in the layout - now no keyboard shows and also text wraps to new line.
android:inputType="none"
android:editable="false"
//remove this
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
Related
I have an EditText with android:inputType="number" and doesn't write anything(numbers) when I press the numbers. The EditText is inside a dialog.
If I change number to numberSigned, the negative character it's OK, is possible to write, but not numbers.
When I change to android:inputType="phone", it doesn't work. But I change to "text" I can write numbers and text....
Same problem writting programatically setInputType(InputType.TYPE_CLASS_NUMBER);
and siscarded problem with mobile.
I don't know what is happening...
XML code:
<EditText
android:id="#+id/edTxtGenerarMicroPersonalizado"
android:paddingTop="3dp"
android:paddingLeft="5dp"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:digits="0123456789"
android:hint="Personalizado"
android:inputType="number"
android:visibility="gone" />
Edit Text declaration:
final EditText edTxtPersonalizado;
edTxtPersonalizado = (EditText) view.findViewById(R.id.edTxtGenerarMicroPersonalizado);
edTxtPersonalizado.setFilters(new InputFilter[]{new InputFilter.LengthFilter(4)});
edTxtPersonalizado.setVisibility(View.VISIBLE);
edTxtPersonalizado.requestFocus();
imm.showSoftInput(edTxtPersonalizado, InputMethodManager.SHOW_IMPLICIT); //Same problem without this
try
android:inputType="numberDecimal"
also, you have android:visibility="gone", so your EditText is not being shown
I am using a edittext with multiline property.when i type any word there is no underline but as i used space or enter key all the text cover by underline .how it can be remove . I dont want to see underline .so please give me any solution..
my xml file is......
<EditText
android:layout_centerInParent="true"
android:id="#+id/etext"
android:layout_width="130dp"
android:layout_height="wrap_content"
android:visibility="invisible"
android:textSize="20dp"
android:background="#null"/>
I suppose you mean underlines that come with auto-suggestions.
If you don't want them, try this
android:inputType="textNoSuggestions"
in your EditText xml.
I have added this EditText field to my program. When I run this program, I have noticed that the cursor will blink very close to the left edge of the text box. I have many more text fields in the same layout. Because of the above mentioned problem, I cant see which text field is focused. So what is the solution?
Here is my code
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="numberDecimal"
android:ems="10"
android:id="#+id/lenbox"
android:textSize="20dp"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_marginLeft="120dp"
android:layout_marginTop="190dp"
android:background="#fb7567" />
You can try a different technique, I don't have an idea if that would be suitable for you or not.
What you can do is, add android:hint in the other EditText while your focus EditText will not show hint, hence giving an idea on where the focus is
I want to hide my password as dot and it happens but problem is it hiding after a second i just want to make a dot as i type i should not show the word i typed there....
here is my code
<EditText
android:id="#+id/name2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/name1"
android:layout_centerHorizontal="true"
android:layout_marginTop="34dp"
android:background="#ff0000"
android:ems="10"
android:hint="Enter Password"
android:inputType="textPassword"
android:password="true" >
I found two different solutions, try both of one:
1) Remove android:inputType="textPassword" from your xml file and instead, in set it in java:
EditText password = (EditText) findViewById(R.id.password_text);
password.setTransformationMethod(new PasswordTransformationMethod());
As you're typing in that edit field, you don't see each character in plain text before it turns into a password dot. Also when making input in fullscreen, the dots will not appear, but the passoword in clear text.
2) Leave android:inputType="textPassword" in your xml. In Java, ALSO set the typeface and passwordMethod:
EditText password = (EditText) findViewById(R.id.register_password_text);
password.setTypeface(Typeface.DEFAULT);
password.setTransformationMethod(new PasswordTransformationMethod());
This approach gave me the hint font I wanted AND gives me the behavior I want with the password dots.
Hope it will help you!...
I have the following AutoCompleteTextView :
<AutoCompleteTextView
android:id="#+id/contact_list_auto_complete_text_view"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:enabled="false"
android:hint=" Enter number"
android:singleLine="true"
android:textSize="20sp" >
</AutoCompleteTextView>
The input to this AutoCompleteTextView is done via a "Dialer" Layout I've created , thus this AutoCompleteTextView is android:enabled="false" and in order to add the user input on my AutoCompleteTextView I use the following code :
String mText =_searchAutoCompleteTextView.getText().toString()+_dialer_digits[position]; //the digit the user clicked upon
_searchAutoCompleteTextView.setText(mText);
_searchAutoCompleteTextView.performCompletion();
if(_searchAutoCompleteTextView.getText().toString().length()>2 && _searchAutoCompleteTextView.getAdapter().getCount()> 0)
{
_searchAutoCompleteTextView.showDropDown();
}
Every thing is working fine except a weird issue :
Since the input is not done by the device's keyboard and only by my dialer with setText() , if the user clicks alot of digits whihc are longer than the AutoCompleteTextView's size last digit is broken and while continuing to input more digits the AutoCompleteTextView does not scroll left. The weird thing about it is that I've tried to enable it and put some long input from the device's keyboard it works perfectly , long text is not broken and scrolling is happening. Since I cannot use the device's keyboard it must be done via my layout and setText()
Many thanks ahead
EDIT:
here is a screen shot :
You can use append instead of setText to move the cursor to the end.
I'm not sure if this will work but have you tried to put your AutoCompleteTextView in a HorizontalScrollView?
<HorizontalScrollView android:layout_width="wrap_content"
android:layout_height="wrap_content">
<AutoCompleteTextView
android:id="#+id/contact_list_auto_complete_text_view"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:enabled="false"
android:hint=" Enter number"
android:singleLine="true"
android:textSize="20sp" >
</AutoCompleteTextView>
</HorizontalScrollView>
Can you provide a screen shot so I can better understand the issue you are having?
You need to set Gravity of AutocompleteTextVIew to right:
<AutoCompleteTextView
android:id="#+id/contact_list_auto_complete_text_view"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:enabled="false"
android:hint=" Enter number"
android:singleLine="true"
android:gravity="right"
android:textSize="20sp" >
</AutoCompleteTextView>