android-edittext

I can not adjust the edittext linespacing

大憨熊 提交于 2019-12-08 08:57:33
问题 I want to adjust the line spacing of edittext. I use a long line, and when I cross the line, linespacing is applied. However, linespacing does not apply when I input Enter key. 回答1: This Library fixed the EditText linespacing issue https://github.com/hanks-zyh/LineHeightEditText 回答2: use this code for line space between two line android:lineSpacingExtra="10dp" whole code is <EditText android:id="@+id/edittext" android:layout_margin="@dimen/activity_horizontal_margin" android:layout_width=

Update EditText in a list view with value from a SeekBar

强颜欢笑 提交于 2019-12-08 08:54:10
问题 I have a ListView and each row item comprises of a SeekBar and an EditText (as in figure below). I need to update the EditText based on the seekbar's value, which I'm able to do if I have both the widget references without a problem. My issue is how do I associate each seekbar to its correct EditText box? Both these widgets are part of a view that I inflate in my adapter. Referencing an EditText directly doesn't seem to be a good idea because of Android's view recycling in the ListView. What

android:hint not disappearing onFocus using EditText [duplicate]

最后都变了- 提交于 2019-12-08 08:17:06
问题 This question already has answers here : EditText android:hint not disappearing onFocus (2 answers) Closed 6 years ago . I am on Android 3+ and I am trying to add hints to my edit text widgets. I tried adding the hint to the layout as follows... <EditText android:id="@+id/bar_name" android:layout_width="fill_parent" android:layout_height="wrap_content" android:inputType="text" android:hint="@string/bar_name_hint" android:imeOptions="actionNext" /> But when I focus on the Text box it writes

How to insert a string value into a dialog message?

白昼怎懂夜的黑 提交于 2019-12-08 07:59:40
问题 I have a editText and a button, if i type "abc" and hit the button it will store the value in my database and will open a dielog box saying it got insert successfully but in the dialog box i also want to show what got insert, so heres the code: EditText texto = (EditText) findViewById(R.id.etAdd); final String resultado = texto.getText().toString(); Button add = (Button) findViewById(R.id.bAdd); add.setOnClickListener(new OnClickListener() { public void onClick(View v) { // TODO Auto

How to switch to numeric with special characters keyboard of EditText in Android by default

风流意气都作罢 提交于 2019-12-08 07:33:42
问题 I want to show this keyboard by default on EditText focus: These actions didn't help: inputType=number inputTYpe=phone numeric=integer setRawInputType(...) How should I do it? 回答1: That old problem still not solved. There's no way to show numeric keyboard with option of switching back. This question discussed here Is there a way to show the numbers first on the soft keyboard for Android? 回答2: try to use this in java: editText.setInputType(InputType.TYPE_CLASS_TEXT); editText.setRawInputType

EditText doesn't start automatically

浪子不回头ぞ 提交于 2019-12-08 07:19:01
问题 In my app, I have an EditText . How do I make it doesn't start automatically? Like: once they open the activity it automatically sets the mouse to the EditText and the keyboard gets opened so they type… Is there anyway I can make it open (the keyboard shows and the user can type) when they clicks on it? 回答1: Ok, so from your question i figure out that your EditText is getting focus while starting the activity. You can disable the focus using following command to suppress the keyboard.

How to search and Highlight Text within an EditText

随声附和 提交于 2019-12-08 06:38:00
问题 I've searched high and low for something that seems to be a simple task. Forgive me, I am coming to Android from other programming languages and am new to this platform and Java. What I want to do is create a dialog pop-up where a user enters text to search for and the code would take that text and search for it within all the text in an EditText control and if it's found, highlight it. I've done this before, for example in VB and it went something similar to this pseudo code: grab the text

How do I get edittext value from a custom AlertDialog where retrieval of values is not in the onClick?

给你一囗甜甜゛ 提交于 2019-12-08 06:35:50
问题 What I am trying to do is to create a custom dialog that overrides an AlertDialog. What it is supposed to do is get some text (at least 2 strings) and then for each of those strings it is supposed to be able to get more information, but I want to do this in custom dialogs. So what is supposed to happen is a user can enter 2 people in an activity screen, and then for the first person, you get a custom dialog and that person can enter three words, and then it jumps to the next custom dialog

Customize Android EditText

痞子三分冷 提交于 2019-12-08 06:09:20
问题 Is there a way that I can customize the android EditText just like the image below? Thanks. 回答1: Try This <LinearLayout android:layout_height="wrap_content" android:layout_width="match_parent" android:background="@color/front_white" android:orientation="vertical"> <EditText android:layout_height="35dip" android:layout_width="fill_parent" android:id="@+id/editText1" android:background="@color/front_white" android:hint="Email Address"></EditText> <TextView android:layout_height="1dip" android

Android select and highlight text in edittext

大城市里の小女人 提交于 2019-12-08 05:55:28
问题 I would like to do an app which has an EditText or TextView that can be selected upon click and highlight the selected text. How can I do that? I tried overriding onClick method on my EditText but seems not working. Here's what I've tried so far: etx.setOnLongClickListener(new OnLongClickListener() { @Override public boolean onLongClick(View v) { int startSelection = etx.getSelectionStart(); int endSelection = etx.getSelectionEnd(); //String selectedText = etx.getText().toString().substring