title: Transparent background for IME UI in android
body: <p>I am trying to implement (yet another!) input method.  I started with the soft keyboard example, which implements uses and extension of the KeyboardView object, which extends View. I want to extend View in a completely different way, so I put the following in my input.xml.  Note that my objective is to have a transparent surface for the UI.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;com.diffstrokes.ime.StrokeView xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:background="@null"
      android:cacheColorHint="@null" &gt;
  &lt;/com.diffstrokes.ime.StrokeView&gt;
  </code></pre>
  
  <p>The activity that calls the IME is obscured by a light gray background. If I change my background color to a translucent red, for example, I see a few lines of pixels of gray above the view background.  Where is this background coming from, and how can I get rid of it?</p>
  
  <hr>
  
  <p>I tried to use a LinearLayout instead of a view.  The LinearLayout contains two View tags.  In my onCreateInputView() function I inflate the LinearLayout with the following:   </p>
  
  <pre><code>LinearLayout llo = 
  (LinearLayout) getLayoutInflater().inflate(
                          R.layout.dslayout, null);
  </code></pre>
  
  <p>The <code>onCreateInputView()</code> completes without problems, but at some point I get an exception, as in the following log:</p>
  
  <pre><code> 06-12 15:17:01.350: E/AndroidRuntime(14002): FATAL EXCEPTION: main
   06-12 15:17:01.350: E/AndroidRuntime(14002):
   java.lang.IllegalStateException: The specified child already has a
   parent. You must call removeView() on the child's parent first. 06-12
   15:17:01.350: E/AndroidRuntime(14002):     at
   android.view.ViewGroup.addViewInner(ViewGroup.java:2117) 06-12
   15:17:01.350: E/AndroidRuntime(14002):     at
   android.view.ViewGroup.addView(ViewGroup.java:2012) 06-12
   15:17:01.350: E/AndroidRuntime(14002):     at
   android.view.ViewGroup.addView(ViewGroup.java:1992) 06-12
   15:17:01.350: E/AndroidRuntime(14002):     at
   android.inputmethodservice.InputMethodService.setInputView(InputMethodService.java:1105)
   06-12 15:17:01.350: E/AndroidRuntime(14002):   at
   android.inputmethodservice.InputMethodService.updateInputViewShown(InputMethodService.java:963)
   06-12 15:17:01.350: E/AndroidRuntime(14002):   at
   android.inputmethodservice.InputMethodService.showWindowInner(InputMethodService.java:1318)
   06-12 15:17:01.350: E/AndroidRuntime(14002):   at
   android.inputmethodservice.InputMethodService.showWindow(InputMethodService.java:1293)
   06-12 15:17:01.350: E/AndroidRuntime(14002):   at
   android.inputmethodservice.InputMethodService$InputMethodImpl.showSoftInput(InputMethodService.java:392)
   06-12 15:17:01.350: E/AndroidRuntime(14002):   at
   android.inputmethodservice.IInputMethodWrapper.executeMessage(IInputMethodWrapper.java:176)
   06-12 15:17:01.350: E/AndroidRuntime(14002):   at
   com.android.internal.os.HandlerCaller$MyHandler.handleMessage(HandlerCaller.java:61)
   06-12 15:17:01.350: E/AndroidRuntime(14002):   at
   android.os.Handler.dispatchMessage(Handler.java:99) 06-12
   15:17:01.350: E/AndroidRuntime(14002):     at
   android.os.Looper.loop(Looper.java:130) 06-12 15:17:01.350:
   E/AndroidRuntime(14002):   at
   android.app.ActivityThread.main(ActivityThread.java:3806) 06-12
   15:17:01.350: E/AndroidRuntime(14002):     at
   java.lang.reflect.Method.invokeNative(Native Method) 06-12
   15:17:01.350: E/AndroidRuntime(14002):     at
   java.lang.reflect.Method.invoke(Method.java:507) 06-12 15:17:01.350:
   E/AndroidRuntime(14002):   at
   com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
   06-12 15:17:01.350: E/AndroidRuntime(14002):   at
   com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) 06-12
   15:17:01.350: E/AndroidRuntime(14002):     at
   dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p>When I inflate a view, this doesn't happen.  Can anyone explain why?</p>