Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to inflate a LinearLayout ( for android keyboard )?
    text
    copied!<p>I'm trying to create an android keyboard, right now I want it just to inflate, i.e. show, linearlayout from main.xml</p> <p>Here's the java file</p> <pre><code>package keyboard.rob.com; import ... public class zyz extends InputMethodService implements KeyboardView.OnKeyboardActionListener { private KeyboardView mInputView; @Override public void onCreate() { super.onCreate(); } @Override public View onCreateInputView() { mInputView = (KeyboardView) getLayoutInflater().inflate(R.layout.main, null); return mInputView; } } </code></pre> <p>main.xml</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android" android:layout_gravity="center" android:id="@+id/LL_whole" android:orientation="vertical" android:clickable="false"&gt; &lt;LinearLayout android:layout_width="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android" android:background="@layout/backrep" android:layout_gravity="center" android:id="@+id/LL_total" android:orientation="vertical" android:layout_height="wrap_content"&gt; &lt;LinearLayout android:layout_height="wrap_content" android:layout_width="match_parent" android:background="@drawable/spell_frame" android:layout_marginBottom="10px" android:layout_marginTop="5px" android:layout_gravity="center" android:id="@+id/LL_spell" android:paddingLeft="10px"&gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:layout_height="wrap_content" android:orientation="horizontal" android:layout_gravity="center" android:layout_width="wrap_content" android:id="@+id/LLrow1"&gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:layout_height="wrap_content" android:layout_gravity="center" android:orientation="horizontal" android:layout_width="wrap_content" android:id="@+id/LLrow2"&gt;&lt;/LinearLayout&gt; &lt;LinearLayout android:layout_height="wrap_content" android:layout_gravity="center" android:orientation="horizontal" android:layout_width="wrap_content" android:id="@+id/LLrow3"&gt;&lt;/LinearLayout&gt; &lt;LinearLayout android:layout_height="wrap_content" android:layout_gravity="center" android:orientation="horizontal" android:layout_width="wrap_content" android:id="@+id/LLrow4"&gt; &lt;/LinearLayout&gt; &lt;/LinearLayout&gt; &lt;/LinearLayout&gt; </code></pre> <p>and the error it crashes with:</p> <pre><code>08-29 20:21:28.128: ERROR/AndroidRuntime(10227): java.lang.ClassCastException: android.widget.LinearLayout </code></pre> <p>Any ideas? Thanks!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload