【发布时间】:2019-09-02 02:16:26
【问题描述】:
我正在使用EditText 发送消息。 EditText 的填充是 30sdp。
问题是当我点击这个EditText时,光标在EditText的中间闪烁,而我希望光标应该在EditText的顶部闪烁。
这是我的代码。
<EditText
android:id="@+id/edremarkspetrolbill"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/tvpetrolbillremarks"
android:layout_marginLeft="@dimen/_7sdp"
android:layout_marginTop="@dimen/_10sdp"
android:layout_marginRight="@dimen/_10sdp"
android:background="@drawable/background_boxsearch"
android:gravity="top"
android:inputType="textMultiLine"
android:padding="@dimen/_30sdp"
android:textColor="@color/colorbluewh"
android:textCursorDrawable="@color/colorbluewh" />
【问题讨论】:
-
请提供您的 XML sn-p。
-
填充是内部间距。您是在告诉
EditText将其所有内容向内移动 30,在每一侧。这包括文本行和光标。如果您不想在顶部使用该填充,则删除padding属性,并单独设置其他三个;即 paddingLeft、paddingRight和paddingBottom。
标签: android android-edittext cursor padding