less than API 19 compatiable lib
ClearEditText SimpleSpinnerEditText SpinnerEditText for less than API 19 App
Step 1. Add the JitPack repository to your build file Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Step 2. Add the dependency
dependencies {
implementation 'com.github.wongkyunban:WEditText_Legacy:v1.0.2'
}
API | Desc |
---|---|
setClearDrawable(Drawable) | set clear button image as same as setCompoundDrawables() |
We also can set drawable through attribute android:drawableEnd
or android:drawableRight
in xml layout.
API | Desc |
---|---|
setPopupBackground(Drawable) | PopupWindow background |
setPopupDivider(Drawable) | divider between items |
setPopupDividerHeight(int) | set height of divider |
setSelectDrawable(Drawable) | set drawable of button to select item |
setItemTextColor(int) | set the text color of the popup items |
setItemTextSize(float) | set the popup item text size |
setOptions(List) | set options |
We also can set drawable through attribute android:drawableEnd
or android:drawableRight
in xml layout.
SimpleSpinnerEditText simpleSpinnerEditText = (SimpleSpinnerEditText)findViewById(R.id.sset);
List<Bean> strings = new ArrayList<Bean>();
for (int i = 0; i < 50; i++) {
Bean bean = new Bean("Tom"+i,"NO."+i);
strings.add(bean);
}
simpleSpinnerEditText.setOptions(strings);
simpleSpinnerEditText.setItemTextColor(Color.BLUE);
simpleSpinnerEditText.setItemTextSize(DensityUtils.sp2px(this,5));
SpinnerEditText is a little from SimpleSpinnerEditText.They both provide editting and selecting options.SpinnerEditText can show items which containe the characters that you are typing.
API | Desc |
---|---|
setPopupBackground(Drawable) | PopupWindow background |
setPopupDivider(Drawable) | divider between items |
setPopupDividerHeight(int) | set height of divider |
setSelectDrawable(Drawable) | set drawable of button to select item |
setItemTextColor(int) | set the text color of the popup items |
setItemTextSize(float) | set the popup item text size |
setHintCount(int) | set the max count of hint itmes while you are typing |
setOptions(List) | set options |
We also can set drawable through attribute android:drawableEnd
or android:drawableRight
in xml layout.
SpinnerEditText spinnerEditText = (SpinnerEditText)findViewById(R.id.set_select_input);
List<String> list = new ArrayList<String>();
for (int i = 0; i < 50; i++) {
list.add("NNo." + i + "号");
}
spinnerEditText.setOptions(list);
spinnerEditText.setItemTextColor(0xff00ff00);
spinnerEditText.setItemTextSize(DensityUtils.sp2px(this,10));
One thining we should know is that we need to override the toString() method in our object instace.Because the item is provided by method toString of instance.