我在我的项目中使用编辑文本。
问题是,每当我在文本框中输入任何内容时,它都会显示出来,但无论我输入多少字符,光标都不会从其起始位置移动。此外,我无法通过单击文本框中的任何特定字符来移动。
我用于包含编辑文本的 xml 文件是这样的
<EditText
android:id="@+id/xEt"
android:layout_width="fill_parent"
android:layout_height="295dp"
android:layout_alignParentLeft="true"
android:ems="10"
android:focusableInTouchMode="true"
android:focusable="true" >
xml文件是:
<?xml version="1.0" encoding="utf-8"?>
<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" >
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/xsubLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:keepScreenOn="true"
android:orientation="vertical" >
<RelativeLayout
android:id="@+id/relativeLayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true" >
</RelativeLayout>
<EditText
android:id="@+id/xEt"
android:layout_width="wrap_content"
android:layout_height="295dp"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:ems="10"
android:inputType="textMultiLine" >
<requestFocus />
</EditText>
</RelativeLayout>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content" android:id="@+id/xK1"
android:layout_height="wrap_content" android:orientation="vertical"
android:visibility="gone">
<include android:id="@+id/xKeyBoard" layout="@layout/gf"></include>
<include android:id="@+id/xtop" layout="@layout/top"></include>
<include android:id="@+id/x11" layout="@layout/x1"></include>
<include android:id="@+id/x12" layout="@layout/x3"></include>
<include android:id="@+id/x13" layout="@layout/x4"></include>
<include android:id="@+id/x14" layout="@layout/x5"></include>
<include android:id="@+id/x15" layout="@layout/x6"></include>
<include android:id="@+id/x16" layout="@layout/x7"></include>
<include android:id="@+id/x17" layout="@layout/x8"></include>
<include android:id="@+id/x18" layout="@layout/x9"></include>
<include android:id="@+id/x19" layout="@layout/x10"></include>
<include android:id="@+id/x20" layout="@layout/x11"></include>
<include android:id="@+id/x22" layout="@layout/x13"></include>
<include android:id="@+id/x23" layout="@layout/x14"></include>
<include android:id="@+id/x24" layout="@layout/x15"></include>
<include android:id="@+id/x25" layout="@layout/x16"></include>
<include android:id="@+id/x26" layout="@layout/x17"></include>
<include android:id="@+id/x27" layout="@layout/x18"></include>
<include android:id="@+id/x28" layout="@layout/x19"></include>
</RelativeLayout>
</RelativeLayout>