A custom EditText-view for having texts of multiple colors in the same EditText-view with a single xml injection call plus an inclusive call to dismiss keyboard or pan/adjust it’s height above the keyboard.
This Library consists of three Views:
- ColorEditText(EditText$SoftEditText) here you can customise the EditText dynamically(JAVA) or statically(XML)
public-methods
public void setText (String textStatement, String colorStatement, boolean textIsHint)
- SoftEditText(EditText) the parent class of the ColorEditText and has the following methods
public-methods
public void CallKeyboard()
public void DismissKeyboard()
public void setPanner(int panHeight,int pannerId) //call this if view is in activity's root-view
public void setPanner(int panHeight,View pannerView) //call if view is not / you have a complex positioning of the views in your layout
public void setkeyboardListener(SoftKeyboard.keyboardListener listener)
public void removekeyboardListener()
- SoftKeyboard which hosts the keyboardListener
public-methods
setImeOptions(ColorEditText ColEx, String type) //pass in type from 'SoftKeyboard.Type'
Activity
Have this in your activity if you specified panning statically/dynamically.
context.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
Gradle
dependencies {
implementation 'com.github.54LiNKeR:ColorEditText:1.0.0'
}
Layout
<linkersoft.blackpanther.text.ColorEditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp"
app:Colours="#F53457:#A31730:#00a0b4"
app:Sentence="Text 1 # Bold Text2% # Text3"
app:TextIsHint="false"
app:panHeight="12"
app:pannerId="@+id/pan"/>