title: android: onClickListener for relativelayout
body: <p>I have a relativelayout and have coded the <code>onTouchListener</code> to highlight background as follows:</p>
  
  <pre><code>    relative3.setOnTouchListener(new OnTouchListener() 
      {
          @Override
          public boolean onTouch(View arg0, MotionEvent event) 
          {
              if(event.getAction()==MotionEvent.ACTION_DOWN )
              {
                  relative3.setBackgroundColor(getResources().getColor(R.color.tran_grey));
              }
  
              if((event.getAction()==MotionEvent.ACTION_UP || event.getAction()==MotionEvent.ACTION_CANCEL))
              {
                  relative3.setBackgroundColor(getResources().getColor(android.R.color.transparent));
              }
              return true;
          }           
      }); 
  </code></pre>
  
  <p>and to perform an action upon <code>onClick</code></p>
  
  <pre><code>    relative3.setOnClickListener(new View.OnClickListener() 
      {
          @Override
          public void onClick(View v) 
          {
              custom_toast("Redirecting...");
          }
      }); 
  </code></pre>
  
  <h2>Question:</h2>
  
  <p>The relativelayout could show highlight upon <code>ACTION_DOWN</code> and turn back to transparent upon <code>ACTION_UP</code>. Yet it is clicked, the toast simply does not appear as coded.</p>
  
  <p>How could that be modified? Thanks!</p>