android-edittext

In TextInputLayout change the color of hint for single letter or alphabet

丶灬走出姿态 提交于 2019-12-07 17:34:14
问题 I have defined TextInputLayout programmatically in my Activity. I have added EditText inside that TextInputLayout, that to programmatically. Now, I have to set the color of hint of that edittext. Here I just have to change the color of single alphabet of the hint. Example - Hint is like, Firstname *. Here i want to change the color of "*" to Red and remaining hint as black in color. I have already tried Html and Spannable String, but both are not working for TextInputLayout. For Spannable i

Get text from dynamically created EditText on click of a button

对着背影说爱祢 提交于 2019-12-07 15:21:43
I am creating a dynamic layout in which I have 2 EditText and one Button. On click of a button a new same king of layout is created. I want , when I click on the button I should be able to get data from edittexts and store them and then add new layout.I am not able to get data from edittext , it is coming up blank. Below is my code . I am also adding screenshot of my layout @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main2); ll_newView = (LinearLayout)findViewById(R.id.ll_newView); scrollView = (ScrollView

Android: addTextChangedListener not working well

折月煮酒 提交于 2019-12-07 15:02:13
问题 I want to react to the user typing inside an EditText so I used the addTextChangedListener method. When the user types a single character the code of onTextChanged is running and everything ok. So if for example the user types "a" then onTextChanged will begin to run . But if the user types another character, for example b , onTextChanged is not being called. (the text in the EditText should be "ab" now) The code: et = (EditText)findViewById(R.id.edittextsearch); et.addTextChangedListener(new

Make text fit exactly as the screen size

≯℡__Kan透↙ 提交于 2019-12-07 14:45:37
问题 I have a long text so I've decided to divide it into pages, and I put a so each swipe scrolls to the next page.. The way I did it was: NumberOfPages=text.length()/CharPerPage; //CharPerPage=500; NumberOfPages++; Chapters.add(text.indexOf(" ", CurrentPage*CharPerPage)); CurrentPage++; int tmp=0; for(int i =NumberOfPages;i>0;i--) { tmp =(CurrentPage*CharPerPage); if(tmp>text.length()) { Chapters.add(text.length()); break; } else { Chapters.add(text.indexOf(" ", tmp)); CurrentPage++; } } So I

Entering Decimal values in Edittext?

▼魔方 西西 提交于 2019-12-07 14:35:50
问题 I have a edit text. i want to enter the decimal values in it. that is when i have enter a first number. it should be like this: .01 then i have enter a second number. it should be like this: .12 then for third one. it should be like this: 1.23 it will go like this.... how to implement this scenario. Any Idea? 回答1: You should add a TextWatcher to the EditText. This will notify you when the text changes. When you know the text has changed, you can run it through a DecimalFormat: DecimalFormat

clickable drawable inside EditText in android

烂漫一生 提交于 2019-12-07 13:58:01
问题 I have an EditText with a drawable inside. I want to make the drawable clickable so that I can have a specific action when user clicks the drawable. How do I do that? My EditText is: <EditText android:id="@+id/phone" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:layout_marginBottom="5dp" android:drawableRight="@drawable/question_mark" android:hint="phone number" android:imeActionId="@+id/phone_num" android:maxLines=

Hint in Android

匆匆过客 提交于 2019-12-07 12:10:34
问题 I tried to show a hint in the EditText of my form, but i can't see that hint that i have set in the XML Layout while my application gets deployed, but i can able see the hint in eclipse designer view, but while getting deployed the same hint suppose to appear is missing, i tried with all the possible ways still i could not get the hint in the EditText... This is one of the Edit Text layout that i have used.. <EditText android:id="@+id/SetTimerSec_EditText01" android:layout_width="60sp"

Android EditText expands to dialog

佐手、 提交于 2019-12-07 11:17:25
问题 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

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

喜欢而已 提交于 2019-12-07 10:22:14
问题 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

Android - EditText overlap with Softkeyboard

那年仲夏 提交于 2019-12-07 10:10:30
问题 I am working on an Activity which have some EditText. When I click/touch on EditText softkeyboard appear. But the EditTexts which are at bottom of the screen, overlap with softkeyboard. Upper half of the EditText is shown and lower half is under the keyboard. I set the android:windowSoftInputMode="adjustPan" in AndroidManifest.xml Any Suggestion about how to avoid it? 回答1: For me i did not want to assume that keyboards heights are a certain measurement. Whatever view your concerned about make