0

我有一个 EditText,当点击一个数字键盘时,通过android:inputType="number". 发生这种情况时,尽管它会将上方的 TextViews 推离屏幕。我想知道是否有办法始终显示数字键盘(然后我可以为所有内容设置固定位置)?

(我没有太多的活动,所以这不像我想节省空间。)我希望用户能够看到被推离屏幕的 TextView,因为它们是根据输入更新的。这是它的样子:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".Name" >

// TextViews that get pushed off

<EditText
    android:id="@+id/editText"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_marginBottom="71dp"
    android:layout_toLeftOf="@+id/enter_input"
    android:ems="10"
    android:inputType="number" >

    <requestFocus />
</EditText>

</RelativeLayout>

这可能吗?还是有更好的方法让所有内容都显示在屏幕上而没有隐藏任何内容?

4

1 回答 1

1

您可以android:windowSoftInputMode="stateAlwaysVisible"在 AndroidManifest.xml 中添加您的活动,以便它强制键盘始终显示。

<activity android:name="[activity_path]" android:windowSoftInputMode="stateAlwaysVisible"/>
于 2012-12-16T21:05:38.257 回答