EditText Prefix Input

Additional

Language
Java
Version
1.1 (Aug 19, 2017)
Created
Aug 19, 2017
Updated
Oct 24, 2018 (Retired)
Owner
Ican Bachors (bachors)
Contributors
Ican Bachors (bachors)
Andi Insanudin (andiisfh)
2
Activity
Badge
Generate
Download
Source code

Advertisement

Android-Prefix-Input

Android library adding a prefix to an EditText.

Gradle

allprojects {
   repositories {
      ...
      maven { url 'https://jitpack.io' }
   }
}
dependencies {
    ...
    compile 'com.github.bachors:Android-Prefix-Input:1.1'
}

Usage

<com.bachors.prefixinput.EditText
 android:id="@+id/foo"
 android:text="http://"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:inputType="text" />

<com.bachors.prefixinput.EditText
 android:id="@+id/bar"
 android:text="+62"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:inputType="number" />

Option

set text programmatically (dynamic)

<com.bachors.prefixinput.EditText
 android:id="@+id/username"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:inputType="text" />
...
import com.bachors.input.EditText
...
EditText username = (EditText) findViewById(R.id.username);

username.setPrefix("123_");

MIT