Skip to content

Instantly share code, notes, and snippets.

@ShinJJang
Created May 26, 2014 09:22
Show Gist options
  • Save ShinJJang/f4db750c6a3914c61412 to your computer and use it in GitHub Desktop.
Save ShinJJang/f4db750c6a3914c61412 to your computer and use it in GitHub Desktop.
Android different background
TableRow last_row = (TableRow) contact_table.getChildAt(contact_table.getChildCount() - 1);
TableRow row;
if (last_row == null || last_row.getChildCount() == 2) {
row = new TableRow(context);
if (last_row != null) {
int color = ((ColorDrawable) last_row.getChildAt(1).getBackground()).getColor();
view.setBackgroundColor(color);
}
} else {
row = last_row;
if (context.getResources().getColor(R.color.contact_name_background_2) == ((ColorDrawable) last_row.getChildAt(0).getBackground()).getColor()) {
view.setBackgroundColor(context.getResources().getColor(R.color.contact_name_background_1));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment