title: How to make my EditText lose focus when I touch something else?
body: <p>I feel somewhat guilty asking, because there are so many questions about, but I couldn't find a solution.</p>
  
  <p>How to make my (single) <code>EditText</code> lose focus when I touch outside? By <em>focus</em> I mean the view being ready to get input, with cursor visible. I would be ok with:</p>
  
  <ul>
  <li>view losing focus when I touch on anything else (e.g., blank space outside);</li>
  <li>view losing focus when I touch other views in my layout.</li>
  </ul>
  
  <p>Now, answers mostly say how to reach the second goal, by adding a click listener to <em>all</em> other views. That would be possible but not the best way in my opinion.</p>
  
  <p>As for the first (view losing focus as soon as you touch outside) lots of input came from:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/a/23963153/4288782">this</a> answer:</li>
  </ul>
  
  <blockquote>
    <p>A focusable view (such as this EditText) only loses focus when another focusable view gains it. Most views are not focusable by default.</p>
  </blockquote>
  
  <p>Looked like the ultimate solution, but setting <code>android:focusable</code> (or focusable in touch mode) on other elements (tried on a <code>RatingBar</code> and a whole <code>Layout</code>) did nothing for me.</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/4828636/edittext-clear-focus-on-touch-outside">this</a> question, where people came up with solutions involving <code>getX()</code> / <code>getY()</code> of the point of touch, and checking whether it was inside the edit text. I find that more complex than the problem itself, and rather discouraging if you have more than one edit text.</li>
  </ul>
  
  <p>Is there anything else for a such common wish? Conceptually speaking, why if I give input to the EditText and tap on (e.g. on a rating bar) that view should be still focused and waiting, with its blinking cursor?</p>