TextView textView = findViewById(R.id.text_view); textView.setBackgroundResource(android.R.color.holo_blue_dark);
TextView textView = findViewById(R.id.text_view); textView.setBackgroundResource(R.drawable.my_image);This code sets the background of a TextView with id "text_view" to a custom image resource named "my_image" in the app's drawable resources. The package library used in these examples is the android.widget package.