title: Set Background tint mode on a View
body: <p>I can set bakground color of ImageView using this function :</p>
  
  <pre><code>imgButton.getDrawable().setColorFilter(0x77000000, PorterDuff.Mode.SRC_ATOP);
  </code></pre>
  
  <p>but when i try the same funtion on a View it doesn't work and it shows me cannot resolve method getDrawable.</p>
  
  <p>I have to use View Type because i inflate Layout Resource File </p>
  
  <pre><code>public class game extends AppCompatActivity {
  RelativeLayout Rel_main_game;
  View pauseButton;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.game);
      Rel_main_game = (RelativeLayout) findViewById(R.id.rlt2);
  
      LayoutInflater myInflater = (LayoutInflater) getApplicationContext().getSystemService(getApplicationContext().LAYOUT_INFLATER_SERVICE);
      pauseButton = myInflater.inflate(R.layout.pause, null, false);
      Rel_main_game.addView(pauseButton);
  
      pauseButton.setOnTouchListener(new View.OnTouchListener() {
          @Override
          public boolean onTouch(View v, MotionEvent event) {
              // Here i want to make the view a little dark to show that it is pressed
              return false;
          }
      });
  
  }
  </code></pre>
  
  <p>Pause.xml Layout</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"&gt;
  
      &lt;ImageView
          android:layout_width="100dp"
          android:layout_height="100dp"
          android:id="@+id/imageView"
          android:src="@drawable/pauseimg"
          android:layout_centerVertical="true"
          android:layout_centerHorizontal="true"
          android:contentDescription="@string/pauseimgS"
          android:focusableInTouchMode="false"/&gt;
  &lt;/RelativeLayout&gt;</code></pre>
  </div>
  </div>
  </p>