EditText in Android doesn't show text when typing while using the on-screen keyboard

后端 未结 3 1181
温柔的废话
温柔的废话 2020-12-11 07:34

I have an activity consisting of 3 EditText fields (amongst other things like TextViews and a few buttons). I also have an AutoCompleteTextView with a list of String\'s usin

3条回答
  •  甜味超标
    2020-12-11 08:10

    In fact your text is being typped, but that's a little bug that makes your text color be the same as your background, so you don't see it. This can be easily fixed by doing 2 things:

    1) Simply change the textColor of your EditText, either defining it in the layout:

    android:textColor="..."
    

    or dynamically:

    EditText et = (EditText) findViewById(R.id.your_edittext);
    et.setTextColor(Color.RED);
    

    2) Change the extended theme in your manifest:

    
    

    3) Create the new theme at res/values/themes.xml which uses fixed styles:

    
    

    4) Now these styles, located at res/values/styles.xml should fix the color:

    
    
    

    I know it's a mess, but try it and if it works, try finding a combination of those attributes that fit to your layout.

提交回复
热议问题