Android. Change the background color of a FrameLayout from code Android. Change the background color of a FrameLayout from code xml xml

Android. Change the background color of a FrameLayout from code


You should not use frameLayoutBalance.setBackgroundColor(R.color.green);

setBackgroundColor required a Color (i.e. its value as describe by Chirag Raval) not a color resources.

use this frameLayoutBalance.setBackgroundColor(getResources().getColor(R.color.green));


Use this code frameLayoutBalance.setBackgroundColor(Color.parseColor("#00aacc"));