To set a background drawable programmatically in Android, you can use the setBackgroundDrawable method of the View class.