android-edittext

Prevent EditText from focussing after rotation

非 Y 不嫁゛ 提交于 2019-12-05 13:08:28
I've implemented a simple EditText that provides a Done button to hide the keyboard and upon rotating to landscape it does not present a full screen dialog for the EditText. But there's a problem. When I tap Done to dismiss the keyboard then I rotate the device to landscape, the keyboard appears. If I dismiss it again then rotate to portrait the keyboard appears yet again. How can I preserve the keyboard visibility state upon rotation - if it was hidden before rotation then don't present it after rotation, but if it was visible before rotation then present it after rotation? <EditText android

EditText and InputFilter cause repeating text

社会主义新天地 提交于 2019-12-05 13:01:29
问题 I'm trying to implement an EditText that limits input to alpha chars only [A-Za-z]. I started with the InputFilter method from this post. When I type "a%" the text disappears then if I hit backspace the text is "a". I've tried other variations on the filter function like using a regex to match only [A-Za-z] and sometimes see crazy behavior like repeating chars, I'll type "a" then "b" and get "aab" then type "c" and get "aabaabc" then hit backspace and get "aabaabcaabaabc"! Here's the code I'm

EditText in dialog android

对着背影说爱祢 提交于 2019-12-05 13:01:14
i have made a edittext in a dialog but i cant get to change the height. AlertDialog.Builder editalert = new AlertDialog.Builder(this); editalert.setTitle("messagetitle"); editalert.setMessage("here is the message"); final EditText input = new EditText(this); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.FILL_PARENT); input.setLayoutParams(lp); editalert.setView(input); editalert.setPositiveButton("Send via email", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton)

Edit Text focus in android

浪子不回头ぞ 提交于 2019-12-05 13:00:14
In my application i have edit text as follows. EditText1 EditText2 EditText3 EditText4 EditText5 EditText6 in xml i declared android:imeOptions="actionNext" and also i write editText1.setOnEditorActionListener(new EditText.OnEditorActionListener() { public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { // TODO Auto-generated method stub if (actionId == EditorInfo.IME_ACTION_DONE || actionId == EditorInfo.IME_ACTION_NEXT) { editText2.requestFocus(); return false; } return false; } }); Now in virtual key board in edit text 1 if i press next i am getting focus into edit text3

Double cursor in EditText for Input Type Number/Phone (RTL Arabic)

為{幸葍}努か 提交于 2019-12-05 12:54:47
I have an EditText set to gravity Right, so that the text starts from the right if the language is Arabic. Note: My application supports RTL, and I am not setting the TextDirection for my EditText as that will have the same problem. Gravity set to Right does the job perfectly. I have an issue only if I set the InputType to Number or Phone. If the InputType is set to number/phone there are double cursor at the beginning and end of the text and it is a bit confusing. To demonstrate this, I have two EditText with InputType Text and Number, Gravity set to Right for both. My application supports

Change the color of the cursor of an EditText in Android across all the sdk

安稳与你 提交于 2019-12-05 12:45:24
问题 Want to change the android's edittext cursor color, that has to be worked on across all the devices 回答1: i had to use a drawable like this: mycursor.xml: <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <size android:width="1dp" /> <solid android:color="@android:color/holo_blue_light"/> <!--make sure its a solid tag not stroke or it wont work --> </shape> in my edit text i set the cursor drawable attributes

How to get elements(findViewById) for a layout which is dynamically loaded(setView) in a dialog?

假如想象 提交于 2019-12-05 12:41:12
问题 I need to get the EditText that's defined in an xml layout which is dynamically loaded as a view in a preference dialog i.e. : public class ReportBugPreference extends EditTextPreference { @Override protected void onPrepareDialogBuilder(AlertDialog.Builder builder) { super.onPrepareDialogBuilder(builder); builder.setView(LayoutInflater.from(ctx).inflate(R.layout.preference_report_bug_layout,null)); EditText edttxtBugDesc = (EditText) findViewById(R.id.bug_description_edittext); // NOT WORKING

AppBarLayout CollapsingToolbar how to disable expand on EditText click?

僤鯓⒐⒋嵵緔 提交于 2019-12-05 12:14:09
In my test app I disable expansion of AppBarLayout when it is collapsed (by scrolling RecycleView ). I do that by adding addOnOffsetChangedListener to AppBarLayout . However, when I click EditText it expands again but, I do not want it to expand. How to disable the expansion of AppBarLayout when I click EditText ? I have put the whole code, so that everyone can copy/paste the code, create new project and test this fast. Here is how the .gif looks Here is XML code: <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com

Android EditText expands to dialog

落花浮王杯 提交于 2019-12-05 11:50:27
I have this layout <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <LinearLayout android:id="@+id/viewer_top" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@android:color/background_dark" android:orientation="horizontal" > <RelativeLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginLeft="4dp" android:layout_marginRight="4dp" android

android EditText lagging when typing text

心不动则不痛 提交于 2019-12-05 10:40:30
Im developing some sort of chat application, all goes wellm but im stuck with one problem. EditText lags, my android keyboard gets freezed on second or some whenever I type some letter in edittext. O din't really know what code to provide, because it's just a simple EditText box. Here's how i make it: linforbutton.add(new LinearLayout(this)); //linear layout on the bottom os creen for edittext and button RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT); params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); linforbutton.get