
在下面的xml文件中.我正在尝试对齐contents.i.e,第一个textvIEw后面跟着edittext,然后在下一行中.依旧紧接着文本是一个接一个地强加给如何解决这个问题.
<?xml version="1.0" enCoding="utf-8"?> <linearLayout xmlns:androID="http://schemas.androID.com/apk/res/androID" androID:layout_wIDth="fill_parent" androID:layout_height="fill_parent" androID:orIEntation="vertical" > <relativeLayout androID:layout_wIDth="match_parent" androID:layout_height="wrap_content" androID:layout_weight="0.70" > <TextVIEw androID:ID="@+ID/hostname" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:layout_alignBaseline="@+ID/ip" androID:layout_alignParentleft="true" androID:text="hostname" /> <EditText androID:ID="@+ID/ip" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:layout_alignParentleft="true" androID:layout_alignParenttop="true" androID:layout_marginleft="39dp" androID:ems="10" androID:inputType="textEmailAddress" > </EditText> <TextVIEw androID:ID="@+ID/username" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:layout_alignBaseline="@+ID/ip" androID:layout_alignBottom="@+ID/ip" androID:layout_alignParentleft="true" androID:text="Hostname" /> <EditText androID:ID="@+ID/username" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:layout_alignleft="@+ID/editText1" androID:layout_below="@+ID/ip" androID:layout_marginleft="45dp" androID:layout_margintop="42dp" androID:ems="10" /> <TextVIEw androID:ID="@+ID/password" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:layout_alignBaseline="@+ID/hostname" androID:layout_alignBottom="@+ID/username" androID:layout_alignParentleft="true" androID:text="Password" /> <EditText androID:ID="@+ID/password" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:layout_below="@+ID/password" androID:layout_centerHorizontal="true" androID:layout_margintop="47dp" androID:ems="10" androID:inputType="textPassword" /> </relativeLayout> </linearLayout>解决方法:
最好的方法是删除所有textvIEw并设置andoID:提示编辑文本.
<?xml version="1.0" enCoding="utf-8"?><linearLayout xmlns:androID="http://schemas.androID.com/apk/res/androID" androID:layout_wIDth="fill_parent" androID:layout_height="fill_parent" androID:orIEntation="vertical" > <EditText androID:ID="@+ID/ip" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:layout_alignParentleft="true" androID:layout_alignParenttop="true" androID:ems="10" androID:hint="Hostname" androID:inputType="textEmailAddress" > </EditText> <EditText androID:ID="@+ID/username" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:ems="10" androID:hint="Hostname" /> <EditText androID:ID="@+ID/password" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:ems="10" androID:hint="Password" androID:inputType="textPassword" /></linearLayout> 总结 以上是内存溢出为你收集整理的Android对齐textview和edittext全部内容,希望文章能够帮你解决Android对齐textview和edittext所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)