Removing text field background

I set the background for the text view and I want to remove it dynamically, but it does not work, are there any suggestions?

if (mToday) {
        monthView[mRow][mColumn].setBackgroundResource(R.color.black);
    }
    else {
        monthView[mRow][mColumn].setBackgroundResource(0);
    }

I found a reasonable explanation here why this happens, but again did not solve the problem.

+5
source share
3 answers

try it.

txtEmail.setBackgroundResource(android.R.color.transparent);
+7
source

try the just modified code 0 to zero in .setBackgroundDrawable , which will work once:

 if (mToday)
 {
     monthView[mRow][mColumn].setBackgroundResource(R.color.black);
 }
else
 {
      monthView[mRow][mColumn].setBackgroundDrawable(null);
 }
+4
source

I think this should work

monthView[mRow][mColumn].setBackgroundDrawable(null);

+3
source

All Articles