Android library adding a prefix to an EditText.
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
...
compile 'com.github.bachors:Android-Prefix-Input:1.1'
}
<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" />
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_");