title: How to create an alphabetical scrollbar displaying all the letter in android?
body: <p>My purpose is to obtain something like that :<br>
  <img src="https://i.stack.imgur.com/3S0YI.jpg" alt="http://appsreviews.com/wp-content/uploads/2010/08/Cures-A-Z-App-for-iPhone.jpg"></p>
  
  <p>But the only examples i can find are lists like that :<br>
  <a href="https://stackoverflow.com/questions/5129250/android-listview-fastscroll-with-alphabet-like-on-iphone-contacts-activity">android - listview fastscroll with alphabet like on iPhone contacts activity</a></p>
  
  <p>Obviously, I don't want a list like the contacts which displays the letters when you fastscroll. I know how to do this.  </p>
  
  <p>Any pointer would be welcome.
  (I tried <a href="https://stackoverflow.com/questions/7129069/how-to-show-alphabetical-letters-on-side-of-android-listview">this</a> but no success)</p>
  
  <p><strong>Below, the full solution as suggest by FunkTheMonk (thanks a lot) :</strong>  </p>
  
  <p>Define the listview as usual. Define a RelativeLayout containing the <code>ListView</code> and on the right, a <code>LinearLayout</code> with all the letters. For a better solution, the list of letters could be generated dynamically to only display the letters in the list. Then in the onClick method, add the behaviour to scroll the list :</p>
  
  <p><strong>xml</strong></p>
  
  <pre><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;ListView android:id="@android:id/list" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_marginRight="28dip" /&gt;
  
      &lt;LinearLayout android:orientation="vertical"
          android:layout_width="28dip" android:layout_height="wrap_content"
          android:layout_alignParentRight="true" android:background="@android:color/transparent" &gt;
  
          &lt;TextView android:id="@+id/A" android:text="A" android:tag="A"
              style="@style/alphabetTextView"/&gt;
          &lt;TextView android:id="@+id/B" android:text="B" android:tag="B"
              style="@style/alphabetTextView" /&gt;
          &lt;TextView android:id="@+id/C" android:text="C" android:tag="C"
              style="@style/alphabetTextView" /&gt;
          &lt;TextView android:id="@+id/D" android:text="D" android:tag="D"
              style="@style/alphabetTextView" /&gt;
          &lt;TextView android:id="@+id/E" android:text="E" android:tag="E"
              style="@style/alphabetTextView" /&gt;
          &lt;TextView android:id="@+id/F" android:text="F" android:tag="F"
              style="@style/alphabetTextView" /&gt;
          &lt;TextView android:id="@+id/G" android:text="G" android:tag="G"
              style="@style/alphabetTextView" /&gt;
          &lt;TextView android:id="@+id/H" android:text="H" android:tag="H"
              style="@style/alphabetTextView" /&gt;
          &lt;TextView android:id="@+id/I" android:text="I" android:tag="I"
              style="@style/alphabetTextView" /&gt;
          &lt;TextView android:id="@+id/J" android:text="J" android:tag="J"
              style="@style/alphabetTextView" /&gt;
          &lt;TextView android:id="@+id/K" android:text="K" android:tag="K"
              style="@style/alphabetTextView" /&gt;
          &lt;TextView android:id="@+id/L" android:text="L" android:tag="L"
              style="@style/alphabetTextView" /&gt;
          &lt;TextView android:id="@+id/M" android:text="M" android:tag="M"
              style="@style/alphabetTextView" /&gt;
          &lt;TextView android:id="@+id/N" android:text="N" android:tag="N"
              style="@style/alphabetTextView" /&gt;
          &lt;TextView android:id="@+id/O" android:text="O" android:tag="O"
              style="@style/alphabetTextView" /&gt;
          &lt;TextView android:id="@+id/P" android:text="P" android:tag="P"
              style="@style/alphabetTextView" /&gt;
          &lt;TextView android:id="@+id/Q" android:text="Q" android:tag="Q"
              style="@style/alphabetTextView" /&gt;
          &lt;TextView android:id="@+id/R" android:text="R" android:tag="R"
              style="@style/alphabetTextView" /&gt;
          &lt;TextView android:id="@+id/S" android:text="S" android:tag="S"
              style="@style/alphabetTextView" /&gt;
          &lt;TextView android:id="@+id/T" android:text="T" android:tag="T"
              style="@style/alphabetTextView" /&gt;
          &lt;TextView android:id="@+id/U" android:text="U" android:tag="U"
              style="@style/alphabetTextView" /&gt;
          &lt;TextView android:id="@+id/V" android:text="V" android:tag="V"
              style="@style/alphabetTextView" /&gt;
          &lt;TextView android:id="@+id/W" android:text="W" android:tag="W"
              style="@style/alphabetTextView" /&gt;
          &lt;TextView android:id="@+id/X" android:text="X" android:tag="X"
              style="@style/alphabetTextView" /&gt;
          &lt;TextView android:id="@+id/Y" android:text="Y" android:tag="Y"
              style="@style/alphabetTextView" /&gt;
          &lt;TextView android:id="@+id/Z" android:text="Z" android:tag="Z"
              style="@style/alphabetTextView" /&gt;
  
      &lt;/LinearLayout&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p><strong>Java</strong>  </p>
  
  <pre><code>@Override
  public void onClick(View v) {
      String firstLetter = (String) v.getTag();
      int index = 0;
      if (stringList != null) {
          for (String string : stringList) {
              if (string.startsWith(firstLetter)) {
                  index = stringList.indexOf(string);
                  break;
              }
          }
      }
      lv.setSelectionFromTop(index, 0);
  }
  </code></pre>