I'm developing a UI with the version17 (With Galaxy Nexus) for Android, and, I got the background white. When I try the same code in a version15 (with Galaxy II) the background is black. So, Why is the color different if the code is the same??
Another question is that I was using to TextView the function setBackground and it's just for the version16 or newer. Is it the setBackgroundResourse the equivalent?
This is an example of as I'm making the code.
FrameLayout frame = new FrameLayout(this);
frame.setId(findId());
FrameLayout.LayoutParams frameParams = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,FrameLayout.LayoutParams.MATCH_PARENT);
frame.setBackgroundResource(idBorder);
frame.setLayoutParams(frameParams);
//Relative layaout que engloba todo
RelativeLayout relativeLayout = new RelativeLayout(this);
//relativeLayout.setId(findId());
RelativeLayout.LayoutParams relativeParams = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
relativeLayout.setLayoutParams(relativeParams);
relativeLayout.setPadding(5, 5, 5, 5);
relativeParams.addRule(RelativeLayout.CENTER_HORIZONTAL);
relativeParams.addRule(RelativeLayout.CENTER_VERTICAL);
relativeLayout.setBackgroundColor(Color.WHITE);
//relativeLayout.setBackground(getResources().getDrawable(idBorder));
relativeLayout.setBackgroundResource(idBorder);
frame.addView(relativeLayout);
//Nombre de la sala
TextView textRoomName = new TextView(this);
textRoomName.setId(findId());
relativeLayout.addView(textRoomName);
textRoomName.setText(room.getName());
RelativeLayout.LayoutParams relativeParamRoomName = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
relativeParamRoomName.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
relativeParamRoomName.setMargins(10, 10, 10, 5);
textRoomName.setLayoutParams(relativeParamRoomName);
textRoomName.setTextColor(Color.parseColor("#040404"));
textRoomName.setTextSize(20);
textRoomName.setTypeface(null, Typeface.BOLD);
textRoomName.setPadding(3, 3, 3, 3);
//textRoomName.setBackground(getResources().getDrawable(idBorder));
textRoomName.setBackgroundResource(idBorder);