List of usage examples for android.widget TableRow setBackground
public void setBackground(Drawable background)
From source file:org.mewx.wenku8.fragment.NavigationDrawerFragment.java
/** * This function clear all the effects on button, and it needs API Level 16. * So if the device is between 4.0-4.1, it will appear no effects. * * Notice:/*from w ww .j av a2 s . c o m*/ * Once the enum MainActivity.FRAGMENT_LIST changes, this function show be edited. */ private void clearAllButtonColor() { // sdk ver is too low if (Build.VERSION.SDK_INT < 16) { try { // Clear icon color ImageButton imageButton; imageButton = (ImageButton) mainActivity.findViewById(R.id.main_menu_ic_rklist); imageButton.setColorFilter(getResources().getColor(R.color.menu_text_color)); imageButton = (ImageButton) mainActivity.findViewById(R.id.main_menu_ic_latest); imageButton.setColorFilter(getResources().getColor(R.color.menu_text_color)); imageButton = (ImageButton) mainActivity.findViewById(R.id.main_menu_ic_fav); imageButton.setColorFilter(getResources().getColor(R.color.menu_text_color)); imageButton = (ImageButton) mainActivity.findViewById(R.id.main_menu_ic_config); imageButton.setColorFilter(getResources().getColor(R.color.menu_text_color)); // Clear icon color effects TextView textView; textView = (TextView) mainActivity.findViewById(R.id.main_menu_text_rklist); textView.setTextColor(getResources().getColor(R.color.menu_text_color)); textView = (TextView) mainActivity.findViewById(R.id.main_menu_text_latest); textView.setTextColor(getResources().getColor(R.color.menu_text_color)); textView = (TextView) mainActivity.findViewById(R.id.main_menu_text_fav); textView.setTextColor(getResources().getColor(R.color.menu_text_color)); textView = (TextView) mainActivity.findViewById(R.id.main_menu_text_config); textView.setTextColor(getResources().getColor(R.color.menu_text_color)); } catch (NullPointerException e) { Toast.makeText(mainActivity, "NullPointerException in clearAllButtonColor(); sdk16-", Toast.LENGTH_SHORT).show(); e.printStackTrace(); } } else { try { // Clear the background effects on "main buttons" TableRow tableRow; tableRow = (TableRow) mainActivity.findViewById(R.id.main_menu_rklist); tableRow.setBackground(getResources().getDrawable(R.drawable.btn_menu_item)); tableRow = (TableRow) mainActivity.findViewById(R.id.main_menu_latest); tableRow.setBackground(getResources().getDrawable(R.drawable.btn_menu_item)); tableRow = (TableRow) mainActivity.findViewById(R.id.main_menu_fav); tableRow.setBackground(getResources().getDrawable(R.drawable.btn_menu_item)); tableRow = (TableRow) mainActivity.findViewById(R.id.main_menu_config); tableRow.setBackground(getResources().getDrawable(R.drawable.btn_menu_item)); // Clear icon color effects TextView textView; textView = (TextView) mainActivity.findViewById(R.id.main_menu_text_rklist); textView.setTextColor(getResources().getColor(R.color.menu_text_color)); textView = (TextView) mainActivity.findViewById(R.id.main_menu_text_latest); textView.setTextColor(getResources().getColor(R.color.menu_text_color)); textView = (TextView) mainActivity.findViewById(R.id.main_menu_text_fav); textView.setTextColor(getResources().getColor(R.color.menu_text_color)); textView = (TextView) mainActivity.findViewById(R.id.main_menu_text_config); textView.setTextColor(getResources().getColor(R.color.menu_text_color)); // Clear icon color ImageButton imageButton; imageButton = (ImageButton) mainActivity.findViewById(R.id.main_menu_ic_rklist); imageButton.setColorFilter(getResources().getColor(R.color.menu_text_color)); imageButton = (ImageButton) mainActivity.findViewById(R.id.main_menu_ic_latest); imageButton.setColorFilter(getResources().getColor(R.color.menu_text_color)); imageButton = (ImageButton) mainActivity.findViewById(R.id.main_menu_ic_fav); imageButton.setColorFilter(getResources().getColor(R.color.menu_text_color)); imageButton = (ImageButton) mainActivity.findViewById(R.id.main_menu_ic_config); imageButton.setColorFilter(getResources().getColor(R.color.menu_text_color)); // Clear the dark and light switcher button effect // textView = (TextView) mainActivity.findViewById(R.id.main_menu_dark_mode_switcher); // textView.setTextColor(getResources().getColor(R.color.main_menu_color_text)); // textView.setBackground(getResources().getDrawable(R.drawable.btn_menu_item)); } catch (NullPointerException e) { Toast.makeText(mainActivity, "NullPointerException in clearAllButtonColor();", Toast.LENGTH_SHORT) .show(); e.printStackTrace(); } } }