title: How to hide drawable right programmatically
body: <p>I am setting drawable right for EditText like below,</p>
  
  <pre><code>editText.setCompoundDrawablesWithIntrinsicBounds(null, null, ContextCompat.getDrawable(getApplicationContext(), R.drawable.ic_clear_black_24dp), null);
  </code></pre>
  
  <p>I am setting drawable left for EditText in xml. I want to set it's visibility to visible or hide.How Do I do that programmatically.</p>
  
  <p>I have EditText for Search. While start typing I am setting clear icon programatically.</p>
  
  <p>Clear icon will clear text in EditText. When clear icon without text is clicked I want to close keyboard and make clear icon hide.
  Below is my code for that,</p>
  
  <pre><code> editText.setOnClickListener(new View.OnClickListener() {
                  @Override
                  public void onClick(View v) {
                      editText.setCursorVisible(true);
                      editText.setCompoundDrawablesWithIntrinsicBounds(null, null, ContextCompat.getDrawable(getApplicationContext(), R.drawable.ic_clear_black_24dp), null);
                  }
              });
              editText.setOnTouchListener(new View.OnTouchListener() {
                  @SuppressLint("ClickableViewAccessibility")
                  @Override
                  public boolean onTouch(View v, MotionEvent event) {
                      if(event.getAction() == MotionEvent.ACTION_UP) {
                          if(editText.getCompoundDrawables()[2]!=null){
                              if(event.getX() &gt;= (editText.getRight()- editText.getLeft() - editText.getCompoundDrawables()[2].getBounds().width())) {
  
                                  if(!editText.getText().toString().equals("")) {
  
                                      editText.setText("");
                                  }
                                  else {
  
                                     // getWindow().setSoftInputMode(
                                       //       WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
                                      editText.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
                                      closeKeyboard();
                                      editText.setCursorVisible(false);
                                  }
                              }
                          }
                      }
                      return false;
                  }
              });
  </code></pre>
  
  <p>I want to hide it programmatically.</p>