Open Parmakli opened 6 years ago
Hello, I can't reproduce this behavior, can you send a whole code example?
Of course, here is layout activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.igor.myapplication.MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!" />
<com.vicmikhailau.maskededittext.MaskedEditText
android:id="@+id/maskedEditText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
app:mask="+7 ### ###-##-##"
android:hint="+7 ### ###-##-##"
android:inputType="phone"/>
<com.vicmikhailau.maskededittext.MaskedEditText
android:layout_height="wrap_content"
android:layout_centerInParent="true"
app:mask="+7 ### ###-##-##"
android:hint="+7 ### ###-##-##"
android:inputType="phone"
android:layout_below="@+id/maskedEditText"
android:layout_centerHorizontal="true"
android:layout_width="wrap_content"/>
</RelativeLayout>
And here is MainActivity
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
title = "MaskedEditText"
maskedEditText.addTextChangedListener(object :TextWatcher{
override fun afterTextChanged(s: Editable?) {
}
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
}
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
}
})
}
}
And that's from gradle
compile ("com.vicmikhailau:MaskedEditText:2.0.4"){
exclude group: 'com.android.support'
}
I have the same problem even without TextWatcher
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/filter_fragment_margin_horizontal"
android:layout_marginLeft="@dimen/filter_fragment_margin_horizontal"
android:layout_marginRight="@dimen/filter_fragment_margin_horizontal"
android:layout_marginStart="@dimen/filter_fragment_margin_horizontal"
android:layout_marginTop="@dimen/filter_fragment_margin_top"
android:textColorHint="@color/filter_text_passive_color">
<com.vicmikhailau.maskededittext.MaskedEditText
android:id="@+id/phone_edittext"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/edit_txt_bg"
android:hint="@string/phone"
android:inputType="number"
android:paddingTop="@dimen/filter_fragment_margin_horizontal"
android:textColor="@color/filter_text_active_color"
android:textSize="@dimen/filter_text_main"
app:mask="+7(###)###-##-##" />
</android.support.design.widget.TextInputLayout>
Hello, Parmakli . Hello, Mkryglikov.
Sorry for the late reply.
Unfortunately, there is no way to devote much time to the project. Please feel free to Fork the project and add Pull requests.
Thanks a lot!
Thanx for the library! For example I have two maskedEditTexts one below other and for the first one I just add another empty TextWatcher
I receive such behaviour: Both have mask and hint +7 ### ###-##-## Workaround is to set empty string as text programmatically before any user action.