我有一个包含编辑框的gridview,在activity上方,下面有一个自定义键盘,如下面的代码所示,我添加了按钮来输入数字。但问题是每当我点击gridview中的edittexts时,软键盘就会弹出。
我尝试将
我尝试将
android:windowSoftInputMode="stateHidden"
放入清单文件中,但在我的情况下它甚至不隐藏软键盘。我参考了很多来源,包括stackoverflow,没有一个帖子离开。我认为我的main.xml文件存在问题。我们不能在gridview的子级中隐藏它吗(我知道这似乎很愚蠢,但这是我经过尝试许多事情后最终得到的疑问)。请问有人能建议我哪里出错了吗?如果您使用您的答案测试以下代码,然后建议我是否有效,我将不胜感激。<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:orientation="vertical" >
<FrameLayout
android:id="@+id/fLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="2"
android:background="@drawable/background3">
<GridView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/gridview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:columnWidth="18dp"
android:numColumns="6"
android:verticalSpacing="0dp"
android:horizontalSpacing="1dp"
android:stretchMode="columnWidth"
android:gravity="center"
android:listSelector="@null"/>
</FrameLayout>
<FrameLayout
android:id="@+id/fLayout2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="4"
android:background="@drawable/background2">
<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/keypad"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:stretchColumns="*">
<TableRow>
<Button android:id="@+id/keypad_1"
android:text="1"
android:background="@drawable/custombutton">
</Button>
<Button android:id="@+id/keypad_2"
android:text="2"
android:background="@drawable/custombutton">
</Button>
<Button android:id="@+id/keypad_3"
android:text="3"
android:background="@drawable/custombutton">
</Button>
<Button android:id="@+id/keypad_4"
android:text="4"
android:background="@drawable/custombutton">
</Button>
<Button android:id="@+id/keypad_5"
android:text="5"
android:background="@drawable/custombutton">
</Button>
</TableRow>
<TableRow>
<Button android:id="@+id/keypad_6"
android:text="6"
android:background="@drawable/custombutton">
</Button>
<Button android:id="@+id/keypad_7"
android:text="7"
android:background="@drawable/custombutton">
</Button>
<Button android:id="@+id/keypad_8"
android:text="8"
android:background="@drawable/custombutton">
</Button>
<Button android:id="@+id/keypad_9"
android:text="9"
android:background="@drawable/custombutton">
</Button>
<Button android:id="@+id/keypad_10"
android:text="C"
android:background="@drawable/custombutton">
</Button>
</TableRow>
<TableRow>
<Button android:id="@+id/submit"
android:text="submit"
android:layout_span="5"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/custombutton">
</Button>
</TableRow>
</TableLayout>
</FrameLayout>
</LinearLayout>