Latest stable version:
How to use (Sample demo provided):
- Add this gradle in
build.gradle(:app)
:
dependencies {
implementation 'com.github.mikkelofficial7:android-compose-edittext-keyboard:v1.2.2'
}
or gradle.kts:
dependencies {
implementation("com.github.mikkelofficial7:android-compose-edittext-keyboard:v1.2.2")
}
- Add it in your root settings.gradle at the end of repositories:
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
- Access the edit text in your compose
Activity
orFragment
class
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
AndroidcomposeedittextkeyboardTheme {
Surface(
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colorScheme.background
) {
Column {
customEditTextWithKeyboard(hintText = "input type text", keyboardType = KeyboardInputType.TEXT)
}
}
}
}
}
- List of supported parameters you can use
defaultText: String,
hintText: String,
@ColorRes textColor: Int = R.color.black, // via colors.xml
@ColorRes hintColor: Int = R.color.black, // via colors.xml
@ColorRes bgColor: Int = R.color.black, // via colors.xml
@ColorRes borderColor: Int = R.color.black, // via colors.xml
borderSize: Int,
textSize: Int,
cornerRadiusSize: Int,
height: Int,
width: Int,
keyboardType: KeyboardInputType,
@DrawableRes iconLeft: Int? = null,
@DrawableRes iconRight: Int? = null,
@ColorRes iconLeftTint: Int? = null,
@ColorRes iconRightTint: Int? = null,
isAllCaps: Boolean, // true or false
isLowerText: Boolean, // true or false
isFullWidth: Boolean, // true or false
isShowKeyboard: Boolean, // true or false
isShowCurrencyType: Boolean = false, // for currency keyboard purpose, true or false
maxLine: Int,
onTextValueChange: (String, String) -> Unit, // if you want to get result typed
modifier: Modifier = Modifier // other customize modifier (if necessary)
List of Supported Keyboard Input Type:
NUMBER,
PHONE,
TEXT,
EMAIL,
PASSWORD_TEXT,
PASSWORD_NUMBER,
CURRENCY