android-edittext

Android - create TextView (or EditText) programmatically and set it in a specific place on the screen giving coordinates

萝らか妹 提交于 2019-12-09 13:30:14
问题 I am building an android app where the user paints some objects in the screen. One type of object is a Text object. The user creates the object by dragging his finger and the object is shown as a rectangle that can be moved/reshaped. When user taps the text object, I launch a new activity where user enters text which I return on the onActivityResult method. Now I want to show the text in the object. I can have access to stuff as the coordinates of the Rectangle etc from my text class. What I

How to use InputConnectionWrapper?

荒凉一梦 提交于 2019-12-09 09:45:08
问题 I have an EditText . Now I want to get all changes made by the user to this EditText and work with them before manually inserting them into the EditText . I don't want the user to directly change the text in the EditText . This should only be done by my code (e.g. by using replace() or setText() ). I searched a bit and found an interesting class named InputConnectionWrapper . According to the javadoc it shall act as a proxy for a given InputConnection . So I subclassed it like this: private

How to avoid cut/copy/paste in smart phone after rotation port to land on Android4.X?

醉酒当歌 提交于 2019-12-09 09:02:24
问题 I am working on to avoid cut/copy/paste in smart phone (for tablet its fine). Its fine in port mode but coming in land mode EditText shows a Button Next. after selecting the text, next button converts into Edit Button which has copy,cut and paste option. So is there any way to disable cut/copy after rotation when edit button appears. i am following this link. How to disable copy/paste from/to EditText 回答1: I think you can use this: http://developer.android.com/reference/android/widget

Passing string from edit text to another activity

白昼怎懂夜的黑 提交于 2019-12-09 07:18:06
问题 I have looked through the example here on stack overflow. However, I can't get a solution that works correctly. My application still crashes. How do I pass the string from an edit text in one activity to another activity? This is my code from the first activity: Button btnGo = (Button) findViewById(R.id.btnGo); btnGo.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub EditText etLocation = (EditText) findViewById(R.id.et

Clear edittext focus and hide keyboard when button is pressed

房东的猫 提交于 2019-12-09 06:53:53
问题 I'm making an app with edittext and a button. When I enter something into edittext and then click a button, I want the keyboard and focus on edittext to disappear but I can't seem to do it. I inserted these 2 lines of code in XML: android:focusable="true" android:focusableInTouchMode="true" I also tried to add this in the button click method: edittext.clearFocus(); this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); And it just won't work, after I

Gboard: Enable GIF insertion on EditText

北战南征 提交于 2019-12-09 04:41:16
问题 I am using the Gboard from Google in my app and when i input a GIF from the keyboard app to my EditText it then shows a toast "The text field does not support GIF insertion from the keyboard" I have search about this a thousand times and can't find out a result Any help would be appreciated. 回答1: Image Keyboard Support Users often want to communicate with emojis, stickers, and other kinds of rich content. In previous versions of Android, soft keyboards (also known as input method editors or

Prevent other language except English in EditText

筅森魡賤 提交于 2019-12-09 04:32:53
问题 My android app has an EditText field where user can give input. But now i want user can't give input other (i.e Japanese, chain's) than English language. 回答1: you can limit the user to enter only specific characters in the edit text, <EditText android:id="@+id/nameText" android:layout_width="177dp" android:layout_height="wrap_content" android:inputType="text" android:digits="abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ" /> By this, the user could only enter English words and space,

Android Auto Scrolling EditText Hint

懵懂的女人 提交于 2019-12-09 03:25:44
问题 problem with making edittext scrollable there is mentioned that it is not scrollable with singleLine=true. So i have 2 options: I check if the user inputs "\n" and delete that, then i have to worry about things in the second line, too. I use a custom textviews which scrolls through in a loop, could this be used here too only for the hint ? <com.test.ScrollingTextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_marginTop=

NestedScrollView is not scrolling due to Editext

谁说胖子不能爱 提交于 2019-12-09 03:07:30
I am facing issue when i have following Structure in NestedScrollView . Here is my xml file : <android.support.v4.widget.NestedScrollView android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/app_base_color" app:layout_behavior="@string/appbar_scrolling_view_behavior" android:id="@+id/nested_view_editprofile" android:focusable="true" > <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android

How to hide keyboard just by one tap outside of an edittext?

喜你入骨 提交于 2019-12-08 22:10:11
问题 I want to hide the keyboard by tapping outside of edittext. This is my xml code: <RelativeLayout android:clickable="true" android:focusable="true" android:focusableInTouchMode="true" android:onClick="rl_main_onClick"> <RelativeLayout //Here there are some widgets including some edittext. </RelativeLayout> This is my java code (MainActivity): public void rl_main_onClick(View view) { InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE); imm