android-edittext

AppCompat and EditText different underline on different API

一笑奈何 提交于 2019-11-30 14:03:34
I'm trying to make underline line color change for EditText (it will be used for input's validation, so it must be able to change in runtime). I'm using AppCompat library. The problem is that on API 21 and above, I see transparent black line (gray overlay), instead of bolded version. How to make it the same as in API 16? I used this code to change tint: final Drawable originalDrawable = view.getBackground(); final Drawable wrappedDrawable = DrawableCompat.wrap(originalDrawable); DrawableCompat.setTint(wrappedDrawable, Color.RED); setBackground(view,wrappedDrawable); Solution found by adding

Android : clear focus on edittext when activity starts

Deadly 提交于 2019-11-30 13:57:36
I've some settings page in my app. Once the activity gets starts directly it focus to edittext and i used following code to clear foucs. <RelativeLayout android:id="@+id/RequestFocusLayout" android:focusable="true" android:focusableInTouchMode="true" android:layout_width="0px" android:layout_height="0px"/> and in java code RelativeLayout focuslayout = (RelativeLayout) findViewById(R.id.RequestFocusLayout); focuslayout.requestFocus(); The above code is working fine when activity starts at first time and if same activity starts again, automatically edittext get focus. Can anyone help me to solve

Android - EditText on status notification

99封情书 提交于 2019-11-30 13:51:47
Does anyone know if I can insert an EditText (for inserting text) on an Android notification? I would like to have a button and an edittext when the button is pressed then get back the text on the edittext. It's possible? Thanks This can be done in Jelly Bean but as far as I know not in version prior to that. Since this is built in to the android system it should be considered and acceptable practice. From the android blog: Bi-directional text support: Android 4.1 helps you to reach more users through support for for bi-directional text in TextView and EditText elements. Android blog post that

CoordinatorLayout messing up setError popup position

时间秒杀一切 提交于 2019-11-30 13:50:54
I'm facing an issue with EditText setError popup position. I'm using the following code in to create the layout: activity_profile.xml <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" tools:context=".ProfileActivity" android:orientation="vertical"> <android.support.design.widget.AppBarLayout

Can I use the soft keyboard without an EditText?

只愿长相守 提交于 2019-11-30 13:45:46
问题 I'm creating a simple typing game in Android. I have no problem getting input from the physical keyboard, but now I'm trying to get the soft keyboard to appear without the EditText. So far, I've tried the following: 1. EditText with visibility="invisible" and this line: ((InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE)).showSoftInput(keyboard_edittext, InputMethodManager.SHOW_FORCED); // SHOW_IMPLICIT also failed 2. This line in the onCreate() : this.getWindow()

How to change default color in all texts in my Android application?

天涯浪子 提交于 2019-11-30 12:50:33
问题 I would like to change all color texts in my application. So I wrote this code and I set my theme in the manifest: <style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar"> <item name="android:textColor">@color/white</item> </style> But only TextView texts are in white. I would like Button and EditText to be in white too. Can anyone help me? Thank you in advance. 回答1: Your Theme: <style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar"> <item name="android

requestFocus not working

微笑、不失礼 提交于 2019-11-30 12:42:16
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:padding="20dp" > <AutoCompleteTextView android:id="@+id/autocomplete_zone" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:dropDownVerticalOffset="0.2dp" android:ems="10" android:hint="@string/zone_hint" android:inputType="text" android:lines="1" android:maxLines="1" android:popupBackground="#00ffffff" android:textColor="#ffffff" android:textColorHint="#ffffff" >

Android execute function after pressing “Enter” for EditText

不想你离开。 提交于 2019-11-30 11:48:20
I have been following the official Android tutorials and somehow am having a problem with this very simple example to execute a function after pressing "Enter" for an EditText. I understand what I'm supposed to do and seem to have everything setup properly, but Eclipse is complaining with this line: edittext.setOnKeyListener(new OnKeyListener() { It underlines setOnKeyListener with the error: The method setOnKeyListener(View.OnKeyListener) in the type View is not applicable for the arguments (new DialogInterface.OnKeyListener(){}) And also underlines OnKeyListener with the error: The type new

Error inflating class EditText on creating TextInputLayout on Android 4.4.2:

折月煮酒 提交于 2019-11-30 11:41:47
I using the TextInputLayout UI mechanism in my login page of the application, everything works great except for device that run the 4.4.2 android version on this devices I have an exception. This is my 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="wrap_content"> <include android:id="@+id/loginInfiLogoRL" layout="@layout/login_infi_logo_layout" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingLeft="-3dp" android:layout

Disable Button when Edit Text Fields empty

懵懂的女人 提交于 2019-11-30 11:29:56
I have two text fields and a Button. I want to disable the Button unless both EditText-Fields are not empty. I tried many solutions here at stackoverflow, but they don't work. Here is my code: import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.text.Editable; import android.text.TextWatcher; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; public class RegisterActivity extends Activity { private EditText editText1; private EditText editText2; //TextWatcher private TextWatcher