android-edittext

Numeric keyboard as default [duplicate]

落花浮王杯 提交于 2019-12-11 02:17:21
问题 This question already has answers here : Closed 6 years ago . Possible Duplicate: EditText with number keypad by default, but allowing alphabetic characters I have an EditText where user can enter both numbers (0 - 9) and characters (a -z, what ever). But I would like to set the numeric soft-keyboard as default. I want the numeric keyboard appearing first, but user can press the [ABC] button and enter what ever character he wants. Is this possible? 回答1: As far as I know, if you use inputType=

ListView with EditText Keyboard Issues

妖精的绣舞 提交于 2019-12-11 02:04:44
问题 In my app, I have an Activity, which contains a Fragment, which contains a ListView with various EditTexts, like so: Activity -> Fragment -> ListView -> EditTexts When an EditText is tapped, the soft keyboard is displayed and one of two things happens: If the Activity has not yet lost focus (via visiting the Android home screen, for example), the entire activity slides up slightly so that the EditText is not obscured by the keyboard. If the Activity has lost focus at some point (again, such

how to limit max characters in edittext with emoji inputs allowed?

天涯浪子 提交于 2019-12-11 02:03:17
问题 I have a requirement where I need to limit the number of characters entered in EditText. I know this can be easily achieved with the attribute android:maxLength for my EditText in my .xml layout file. But my problem is my EditText should also allow users to enter emojis. Now the catch is, the length of some of the emojis is sometimes 2 or sometimes 1. So, android:maxLength=1 doesn't allow entering emojis with length = 2. I can get the correct length of a string (with each emoji character

Click event on EditText's drawableRight not working properly?

感情迁移 提交于 2019-12-11 01:58:20
问题 I need to open phone's contact book on the click of EditText 's drawableRight . Click event on drawableRight is working fine But the problem is, when I click/touch on anywhere on EditText it is also execute click event and open contact list. I take help for manage click event on drawableRight from here Please check this link. I don't want to open contact list when I click on EditText , I only want to open it when I click drawableRight (image). So how solve this problem? Here is my code:

Disable autosuggestion/autocomplete on editText without using Visible Password method

故事扮演 提交于 2019-12-11 01:53:15
问题 I'm trying to disable auto-complete on my editText and I've tried the following methods: android:inputType="textFilter" //doesn't work or android:inputType="textNoSuggestions" // doesn't work or myedittext.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS); // doesn't work or myedittext.setInputType(InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD); // doesn't work or android:inputType="textVisiblePassword" //it does work, but I can't toggle kanji //if I use Japanese characters, so I'd like

How to create ICS holo style edit text for older versions?

冷暖自知 提交于 2019-12-11 01:38:01
问题 I have searched lot of sites for creating ICS holo style EditText in Android older versions. But the results did not helped me. Please provide me some sample links/code. 回答1: Copy the images from the android-sdk folder, and use them. Search here for textfield_bg_* /android-sdks/platforms/android-16/data/res/drawable-mdpi 回答2: Basically you want to download this xml selector drawable and put it as the background of each EditText : https://github.com/android/platform_frameworks_base/blob/master

Multi-colored border EditText

隐身守侯 提交于 2019-12-11 01:21:40
问题 I'm trying to figure out how to make a custom EditText that has black borders along it's right and left sides, a green border on top, and a blue border on the bottom. See below: I'm fairly new to Android development and I've spent quite a lot of time reading their documentation but haven't had any luck finding anything on this kind of customization. I know in CSS you can just use the border-right, border-left, etc... properties but not sure if it's that straightforward in Android development.

Remove focus from a EditText in Android [duplicate]

我只是一个虾纸丫 提交于 2019-12-11 01:08:05
问题 This question already has answers here : Android: Force EditText to remove focus? [duplicate] (19 answers) Closed 3 years ago . I have two EditText s and one CheckBox and a Button in my layout in the above order. After entering the values to the EditText , the user has to accept terms and conditions by clicking the Checkbox . I need to remove focus from EditText s after the checkbox is clicked. Right now the focus is always on the second EditText . How can this be achieved? Please help.

OnClickListener listens only on the second time

别来无恙 提交于 2019-12-11 01:07:22
问题 I have an editText and have added an onClickListener to it. In the click method I am just clearing the text. When I click the editText first time the keypad pops up. But it is not going into the onClick method. The second time when I click it it is called and clears the text. qtyEditTxt=(EditText)findViewById(R.id.qtyet); qtyEditTxt.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { qtyEditTxt.setText(""); } }); I saw a question with an answer stating to make

How display formatted text in EditText?

拟墨画扇 提交于 2019-12-11 00:50:22
问题 Now I am writing simple note app. And i need to display formatted separate selected text in EditText. I tried, EditText et = (EditText)findViewById(R.id.edittext); String string; int startSelection = et.getSelectionStart(); int endSelection = et.getSelectionEnd(); string = et.getText().toString(); string.substring(startSelection, endSelection); Spanned s = Html.fromHtml("<font color=\"red\">" + string + "</font>"); et.setText(s); This solution displays only separate selected text. But i need