How to change the floating label color of TextInputLayout

Try The Below Code It Works In Normal State <android.support.design.widget.TextInputLayout android:layout_width=”match_parent” android:layout_height=”wrap_content” android:theme=”@style/TextLabel”> <android.support.v7.widget.AppCompatEditText android:layout_width=”match_parent” android:layout_height=”wrap_content” android:hint=”Hiiiii” android:id=”@+id/edit_id”/> </android.support.design.widget.TextInputLayout> In Styles Folder TextLabel Code <style name=”TextLabel” parent=”TextAppearance.AppCompat”> <!– Hint color and label color in FALSE state –> <item name=”android:textColorHint”>@color/Color Name</item> <item name=”android:textSize”>20sp</item> <!– Label color in TRUE state and bar color FALSE and TRUE State … Read more

Changing EditText bottom line color with appcompat v7

Finally, I have found a solution. It simply consists of overriding the value for colorControlActivated, colorControlHighlight and colorControlNormal in your app theme definition and not your edittext style. Then, think to use this theme for whatever activity you desire. Below is an example: <style name=”Theme.App.Base” parent=”Theme.AppCompat.Light.DarkActionBar”> <item name=”colorControlNormal”>#c5c5c5</item> <item name=”colorControlActivated”>@color/accent</item> <item name=”colorControlHighlight”>@color/accent</item> </style>

Put constant text inside EditText which should be non-editable – Android

Did u try this method? final EditText edt = (EditText) findViewById(R.id.editText1); edt.setText(“http://”); Selection.setSelection(edt.getText(), edt.getText().length()); edt.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { // TODO Auto-generated method stub } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { // TODO Auto-generated method stub } @Override public … Read more

Android EditText delete(backspace) key event

NOTE: onKeyListener doesn’t work for soft keyboards. You can set OnKeyListener for you editText so you can detect any key press EDIT: A common mistake we are checking KeyEvent.KEYCODE_BACK for backspace, but really it is KeyEvent.KEYCODE_DEL (Really that name is very confusing! ) editText.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) … Read more

Handling click events on a drawable within an EditText

Actually you don’t need to extend any class. Let’s say I have an EditText editComment with a drawableRight editComment.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { final int DRAWABLE_LEFT = 0; final int DRAWABLE_TOP = 1; final int DRAWABLE_RIGHT = 2; final int DRAWABLE_BOTTOM = 3; if(event.getAction() == MotionEvent.ACTION_UP) { if(event.getRawX() >= … Read more

How to show soft-keyboard when edittext is focused

To force the soft keyboard to appear, you can use EditText yourEditText= (EditText) findViewById(R.id.yourEditText); yourEditText.requestFocus(); InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(yourEditText, InputMethodManager.SHOW_IMPLICIT); And for removing the focus on EditText, sadly you need to have a dummy View to grab focus. To close it you can use InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(yourEditText.getWindowToken(), 0); This works … Read more

Android: show soft keyboard automatically when focus is on an EditText

You can create a focus listener on the EditText on the AlertDialog, then get the AlertDialog‘s Window. From there you can make the soft keyboard show by calling setSoftInputMode. final AlertDialog dialog = …; editText.setOnFocusChangeListener(new View.OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if (hasFocus) { dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE); } } });