title: How to add scrollview to keyboardView in android
body: <p>I've been trying to add scrollview to my android custom keyboard Ime , but nothing i've try not working so far.</p>
  
  <p>Here is part of my code </p>
  
  <p>keyboard.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;ScrollView
      android:layout_height="wrap_content"
      android:layout_width="wrap_content"
      xmlns:android="http://schemas.android.com/apk/res/android"&gt;
  
      &lt;android.inputmethodservice.KeyboardView
          android:id="@+id/keyboard"
          xmlns:android="http://schemas.android.com/apk/res/android"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:isScrollContainer="true"
          android:scrollbarAlwaysDrawHorizontalTrack="true"
          android:scrollbarStyle="insideOverlay"
          android:scrollbars="horizontal"
          android:focusable="true"
      /&gt;
  &lt;/ScrollView&gt;
  </code></pre>
  
  <p>.java</p>
  
  <pre><code> @Override
      public View onCreateInputView() {
          context = getApplicationContext();
          ScrollView scroll = (ScrollView)getLayoutInflater().inflate(R.layout.keyboard,null);
          kv = (KeyboardView)scroll.findViewById(R.id.keyboard);
          keyboard = new Keyboard(this, R.xml.qwerty);
          kv.setPreviewEnabled(false);
          kv.setKeyboard(keyboard);
          kv.setHorizontalScrollBarEnabled(true);
          kv.canScrollHorizontally(1);
          kv.setOnKeyboardActionListener(this);
  
          return kv;
      }
  </code></pre>
  
  <p>I get the error below </p>
  
  <pre><code>&gt; java.lang.IllegalStateException: The specified child already has a
  &gt; parent. You must call removeView() on the child's parent first.
  </code></pre>
  
  <p>Expected: Scroll like image below(Cant upload here , looks like my reputation not enough for that :) ) </p>
  
  <p><a href="http://www.fandroides.com/wp-content/uploads/2014/04/Google-keyboard-emojis.png">http://www.fandroides.com/wp-content/uploads/2014/04/Google-keyboard-emojis.png</a></p>
  
  <p>Any help will be appreciated.
  Thank You</p>