如何将文本放在顶部的EditText小部件内? [英] How do I place the text inside an EditText widget at the top?
本文介绍了如何将文本放在顶部的EditText小部件内?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我具有以下xml,代表整个屏幕的edittext和按钮.唯一的问题是我找不到一种方法来将输入文本置于edittext的顶部.现在,它被放置在editText的中心.
I have the following xml for an edittext and button which take the whole screen. The only problem is I can't find a way to make the typed text in the edittext to be put at the top. Right now it's put in the centre of the editText.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:background="@drawable/herinnering_background"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<EditText
android:id="@+id/invoerTekst"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:hint="@string/prompt_tekst" />
<Button
android:id="@+id/klaar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0"
android:text="@string/action_sla_op"
android:background="@drawable/main_button_over"
android:textColor="#ffffff"
android:layout_margin="5dip"
android:layout_below="@id/invoerTekst" />
</LinearLayout>
推荐答案
在EditText
中添加android:gravity="top"
属性.
这篇关于如何将文本放在顶部的EditText小部件内?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文