When edittext is select, theme/style does not change

前端 未结 4 1630
长发绾君心
长发绾君心 2021-01-26 09:56

I have Edittext in my signup form. When user touch on edittext then edittext box turn to green( which represent that edittext is selected ) i don\'t want this. when user select

4条回答
  •  春和景丽
    2021-01-26 10:16

    Use latest material library

    app/build.gradle

    implementation 'com.google.android.material:material:1.2.0-alpha06'
    

    styles.xml

    
    
    

    layout XML

        
            
        
    

    Kotlin code

        text_input_layout.boxStrokeColor = Color.CYAN
        text_input_layout.defaultHintTextColor = ColorStateList.valueOf(Color.YELLOW)
        text_input_layout.setErrorTextColor(ColorStateList.valueOf(Color.RED))
        text_input_layout.setErrorIconTintList(ColorStateList.valueOf(Color.RED))
        edit_text.backgroundTintList = ColorStateList.valueOf(Color.LTGRAY)
    

    When the textfield is focused/selected/highlighted:

    When the textfield is in error state:

提交回复
热议问题