Home

Awesome

EditTextView

Android widget combination of ImageView, EditText and TextView based on Material Design guidelines.

Sample Screenshot

Usage

For a working implementation in the sample app, see the app/ folder.

  1. Add the dependency in your build.gradle

         compile 'com.gregacucnik:edittextview:1.6'
         
    
  2. Include EditTextView widget in your layout

            <com.gregacucnik.EditTextView
                    android:id="@+id/ettExample"
                    android:layout_width="match_parent"
                    android:layout_height="48dp"
                    app:ettIcon="@drawable/icon_normal"
                    app:ettIconEmpty="@drawable/icon_no_text"
                    app:ettIconInEditMode="@drawable/icon_when_typing"
                    app:ettEmptyTexStyle="normal"
                    app:ettShowHint="false"
                    app:ettEmptyText="Add text&#8230;" />
    

3. (Optional - if you want to exit EditMode when you click outside of EditTextView) Implement OnClickListener for EditTextView parent layout and requestFocus.

    ```
        final LinearLayout llContainer = (LinearLayout)findViewById(R.id.llContainer);
        
        llContainer.setClickable(true);
        llContainer.setFocusable(true);

        llContainer.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                llContainer.requestFocus();
            }
        });
  1. (Optional) Implement EditTextViewListener to get callbacks for onEditTextViewEditModeStart() and onEditTextViewEditModeFinish(String text).

Customization

Add xmlns:app="http://schemas.android.com/apk/res-auto" to (root) layout

Android Arsenal

License

The MIT License (MIT)

Copyright (c) 2016 Grega Čučnik

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.