中心EDITTEXT键入文本 [英] Center typed text in editText
本文介绍了中心EDITTEXT键入文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个EditText和按钮,把整个屏幕下面的XML。唯一的问题是我不能找到一种方法,使在EditText上键入的文本在顶部放。现在它是放在EDITTEXT的中心。
<的EditText
机器人:ID =@ + ID / invoerTekst
机器人:layout_width =FILL_PARENT
机器人:layout_height =0dp
机器人:layout_weight =1
机器人:提示=@字符串/ prompt_tekst/> <按钮
机器人:ID =@ + ID / klaar
机器人:layout_width =FILL_PARENT
机器人:layout_height =WRAP_CONTENT
机器人:layout_weight =0
机器人:文字=@字符串/ action_sla_op
机器人:背景=@绘制/ main_button_over
机器人:文字颜色=#FFFFFF
机器人:layout_margin =5dip
机器人:layout_below =@ ID / invoerTekst/>< / LinearLayout中>
解决方案
添加安卓重力=顶
属性的的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.
<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>
解决方案
Add android:gravity="top"
attribute to your EditText
.
这篇关于中心EDITTEXT键入文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文