Generally, the themes can be generate in xml file with modifying colors, dimensions and styles. ( https://developer.android.com/guide/topics/ui/look-and-feel/themes )
you can change already defined theme on programmatically.
public void onCreate(Bundle savedInstanceState) {
setTheme(android.R.style.Theme);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_second);
}
But, you can not modify xml files on runtime. if you want to change dimensions and colors of view items. You should create java classes which are stored all dimensions and colors as constant, and you can call the on your setTheme() method for set items attributes programmatically.