EditText Prefix Input

Additional

Language
Java
Version
1.1 (Aug 19, 2017)
Created
Aug 19, 2017
Updated
Aug 24, 2017
Owner
Ican Bachors (bachors)
Contributor
Ican Bachors (bachors)
1
Activity
Badge
Generate
Download
Source code

Commercial

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