Tag: android-edittext

Android:how to clear an edittext by cross button in the right side

I have created an edittext for search, which contains in the left side a search icon and in the right side a cross icon: <EditText android:id=”@+id/Search” android:layout_width=”250dp” android:layout_height=”wrap_content” android:drawableLeft=”@android:drawable/ic_menu_search” android:drawableRight=”@android:drawable/ic_delete” android:hint=”Search Product ..” > </EditText> I want to know how can i clear the content of editText when I click in the cross button. Thank […]

Android EditText/TextView how to make each word start with uppercase and all remaining characters of words to be lowercase

I have already used following options to make each starting letter of a word Uppercase <EditText android:inputType=”text|textCapWords”/> While typing the user has option on the keyboard to change the case of letter i.e. the user with this option can easily type lowercase letters. Further,I want text on my EditText to be on this format Each […]

How to make EditText hint not to wrap?

I have a one line EditText, when I set a long hint, the hint wraps to two lines. Can I force the EditText to be always one line tall? android:lines=”1″ didn’t work.

Error inflating class EditText on creating TextInputLayout on Android 4.4.2:

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_marginTop=”5dp” android:layout_marginBottom=”10dp”/> <!–EMAIL–> <android.support.design.widget.TextInputLayout android:id=”@+id/email_wrapper” android:layout_width=”match_parent” […]

Android – Can't get value from EditText inside Custom Dialog

I have been unsuccessful in getting the input from my EditText object inside my custom dialog. public class SetCityDialog extends DialogFragment { @Override public Dialog onCreateDialog(Bundle savedInstanceState) { super.onCreate(savedInstanceState); LayoutInflater factory = LayoutInflater.from(MainActivity.this); final View view = factory.inflate(R.layout.city_dialog, null); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); // Get the layout inflater LayoutInflater inflater = getActivity().getLayoutInflater(); builder.setView(inflater.inflate(R.layout.city_dialog, null)) […]

How to get elements(findViewById) for a layout which is dynamically loaded(setView) in a dialog?

I need to get the EditText that’s defined in an xml layout which is dynamically loaded as a view in a preference dialog i.e. : public class ReportBugPreference extends EditTextPreference { @Override protected void onPrepareDialogBuilder(AlertDialog.Builder builder) { super.onPrepareDialogBuilder(builder); builder.setView(LayoutInflater.from(ctx).inflate(R.layout.preference_report_bug_layout,null)); EditText edttxtBugDesc = (EditText) findViewById(R.id.bug_description_edittext); // NOT WORKING } } EDIT : SOLUTION by jjnFord @Override […]

TextInputLayout hint color

I’m using new Google design library (com.android.support:design:22.2.0) and I have problem with android.support.design.widget.TextInputLayout. If I set its EditText programmatically, floating hint color is gray instead of accent color. It works if user fills field (EditText) itself or if he changes preddefined value of field. This is my code: <android.support.design.widget.TextInputLayout android:layout_height=”wrap_content” android:layout_width=”match_parent”> <EditText android:id=”@+id/register_username” android:layout_width=”match_parent” android:layout_height=”wrap_content” […]

android : how to change the style of edit text?

I’m trying to change the style of the EditText? Is it possible to achieve that? If so I’ll appreciate being told about it, otherwise what alternative ways are available.

Edit Text key listener

I have an edittext and a button in my layout and in my code I’m setting keyListener of the edittext as null editText.setKeyListener(null); so that I cannot type into my edittext. Now on my button click I should be able to type into my ediitext. How can I do that. It’s a simple problem, but […]

Add EditText to Toolbar

My Toolbar and EditText look like this: I tried adding it as an ActionView but I got this result: It basically just added my words ‘Tap Below’ as a title without the TextView Here’s what I did: menu.xml <menu> … … <item android:id=”@+id/edit_text_menu” android:orderInCategory=”300″ android:title=”Tap Below” android:actionLayout=”@layout/edit_text_layout” app:showAsAction=”ifRoom|collapseActionView” /> </menu> edit_text_layout.xml <?xml version=”1.0″ encoding=”utf-8″?> <EditText […]

Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.