当我在 main.xml 图形 View 中编码(参见下面的代码)时,我正在尝试为 2.1 及更高版本编写软键盘,但不显示任何内容并显示无 XML 内容。请在您的文档中添加 Root View 或布局”我已经尝试将代码放在 textview 中,但仍然没有运气,我根本无法让软键盘显示,就好像我的代码被忽略了..我已经尝试了这两个单独编码没有任何作用
<com.example.android.softkeyboard.LatinKeyboardView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/keyboard"
android:layout_alignParentBottom="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
<Keyboard
android:keyWidth="%10p"
android:keyHeight="50px"
android:horizontalGap="2px"
android:verticalGap="2px" >
<Row android:keyWidth="32px" >
<Key android:keyLabel="A" />
...
</Row>
...
</Keyboard>
最佳答案
请把你的代码放在线性布局中
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<com.example.android.softkeyboard.LatinKeyboardView
android:id="@+id/keyboard"
android:layout_alignParentBottom="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
<Keyboard
android:keyWidth="%10p"
android:keyHeight="50px"
android:horizontalGap="2px"
android:verticalGap="2px" >
<Row android:keyWidth="32px" >
<Key android:keyLabel="A" />
...
</Row>
...
</Keyboard>
</LinearLayout>
关于android - "No XML content. Please add a root view or layout to your document",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9987788/