0

I recently updated my android studio from 4.0 to 4.1.3.I couldn't change my TextView color as well as Button background color.

enter image description here

Here is my kotlin code of MainActivity

class MainActivity : AppCompatActivity() {

    @SuppressLint("ResourceAsColor")
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        //setContentView(R.layout.activity_main)
        val binding = ActivityMainBinding.inflate(layoutInflater)
        setContentView(binding.root)
        binding.tvMain.setText("Register")
        binding.tvMain.setTextColor(R.color.black)
        binding.tvMain.setOnClickListener(View.OnClickListener {
        })
    }
}
James Z
  • 12,209
  • 10
  • 24
  • 44
knoe ken
  • 1
  • 2
  • you declare in your xml and u doing same in your java code. what do u mean to achieve ??both are same thats why u cant see the changes, – D_K Apr 24 '21 at 05:14
  • try to change changed "Register to "Registration" in java file – D_K Apr 24 '21 at 05:14
  • What is the issue? – Gabriele Mariotti Apr 24 '21 at 05:48
  • Hey @D_K I declair both side because ,XML side is not working so try kotlin backend side but it doesn't work. – knoe ken Apr 24 '21 at 07:23
  • Does this answer your question? [Android Background Drawable Not Working in Button Since Android Studio 4.1](https://stackoverflow.com/questions/64722733/android-background-drawable-not-working-in-button-since-android-studio-4-1) – Sam Chen May 01 '21 at 19:55

1 Answers1

0

Do change the Primary color in your theme style for the button background color. Do change the text color in xml as android:textColor-"your color in # format"