Java 自定义编辑文本指针位置
好吧,我对安卓有点陌生。因此,我非常关注一些在线教程,让自己参与一些开发 我是计算机科学专业的本科生,所以我对Java的了解相当广泛。我只是在XML方面遇到了一些问题,因为我以前从未使用过它 我试图用一些简单的登录表单创建一个LoginActivity 我需要把指针稍微向右移动,这样它就在盒子里面了 这是我的.xml文件Java 自定义编辑文本指针位置,java,android,xml,eclipse,android-edittext,Java,Android,Xml,Eclipse,Android Edittext,好吧,我对安卓有点陌生。因此,我非常关注一些在线教程,让自己参与一些开发 我是计算机科学专业的本科生,所以我对Java的了解相当广泛。我只是在XML方面遇到了一些问题,因为我以前从未使用过它 我试图用一些简单的登录表单创建一个LoginActivity 我需要把指针稍微向右移动,这样它就在盒子里面了 这是我的.xml文件 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tool
<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"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.unibites.LoginActivity" >
<ImageButton
android:id="@+id/signinBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="159dp"
android:background="#00000000"
android:contentDescription="@string/desc"
android:src="@drawable/signin_btn" />
<EditText
android:id="@+id/userEt"
android:inputType="text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/signinBtn"
android:layout_alignRight="@+id/signinBtn"
android:layout_marginBottom="86dp"
android:background="@drawable/text_field"
android:ems="10" />
我不知道你在这里添加了什么
android:background="@drawable/text_field"
如果没有这段xml属性,活动将运行得非常好!:)
再多一点代码或细节会更有帮助
编辑无法拍摄光标的屏幕截图(它会闪烁!:p)
相关答案
首先,指针在它应该在的地方闪烁…这是需要整理的图像
在编辑文本中使用9patch图像可以解决您的问题
使用此选项将图像转换为9patch,然后在视图中使用它
有关更多信息,请参阅
另外,我现在就用它了。如果能提供更多的信息,我会非常感激的。这是编辑文本框背景的图像。我需要图像在那里,并且由于图像的原因,编辑文本将其对齐到图像的最左侧位置代码>其中位置是要设置光标位置的索引/偏移