这是我的布局屏幕截图:
我怎样才能安排所有这些TextView使其具有良好的格式(标题要承担责任(意味着要意识到)..对齐方式等)。
<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"
tools:context=".Menu"
android:background="@android:color/holo_blue_bright"
>
<TextView
android:text="*Follow safety guide for moving around the town and between towns."
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textView25"
android:gravity="left"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginBottom="51dp" />
<TextView
android:text="*Avoid crowds and do not participate actively in demonstrations even when it is related to programme work."
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textView25"
android:gravity="left"
android:layout_below="@+id/textView25"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginTop="15dp" />
<TextView
android:text="*Avoid crowds and do not participate actively in demonstrations even when it is related to programme work."
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textView25"
android:gravity="left"
android:layout_marginBottom="23dp"
android:layout_above="@+id/textView25"
android:layout_toRightOf="@+id/textView25"
android:layout_toEndOf="@+id/textView25" />
<TextView
android:text="*keep this briefing pack in an accessible place, and the emergency numbers in your mobile phone memory"
android:layout_width="wrap_content"
android:gravity="bottom"
android:layout_height="wrap_content"
android:id="@+id/textView28"
android:layout_above="@+id/textView25"
android:layout_toRightOf="@+id/textView25"
android:layout_toEndOf="@+id/textView25"
android:layout_marginBottom="46dp" />
<TextView
android:gravity="center"
android:textColor="#000"
android:textSize="15dp"
android:text="Taking resposibility(means being aware)"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/textView22"
android:layout_marginTop="18dp"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<TextView
android:text="*Avoid moving around town by yourself and always make others aware of your location."
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:id="@+id/textView25"
android:layout_marginTop="76dp"
android:layout_below="@+id/textView22"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<TextView
android:text="*Share any security information that might have implications for Ballloon Ventures to the Country Manager or pc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textView24"
android:gravity="left"
android:layout_below="@+id/textView26"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginTop="30dp" />
<TextView
android:text="*If using host home accommondation,check that it is secure.if it is not,tell the Programme Coordinator"
android:layout_width="wrap_content"
android:gravity="bottom"
android:layout_height="wrap_content"
android:id="@+id/textView28"
android:layout_marginTop="14dp"
android:layout_below="@+id/textView24"
android:layout_alignRight="@+id/textView25"
android:layout_alignEnd="@+id/textView25" />
<TextView
android:text="*Report all incidents to your Programmer Cordinator."
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textView26"
android:gravity="left"
android:layout_below="@+id/textView25"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginTop="55dp" />
</RelativeLayout>
因为如果我拖动一个TextView,它将影响所有其他TextView。
正如@GabeSechan所说,您需要了解RelativeLayout中android:layout_xxx属性的含义。
通过布局编辑器在RelativeLayout中移动视图时,需要考虑布局中的以下某些属性:
android:layout_above="@+id/textView25"
android:layout_below="@+id/textView24"
android:layout_toRightOf="@+id/textView25"
android:layout_toEndOf="@+id/textView25"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_above="@+id/textView25"
表示您希望在textView25上方的View视图。
android:layout_below="@+id/textView24"
表示您要在textView25视图下面查看。
以下属性意味着您希望该视图位于TextView25视图的右侧:
android:layout_toRightOf="@+id/textView25"
android:layout_toEndOf="@+id/textView25"
以下属性表示您希望视图与父布局的左侧对齐:
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
如果要在RelativeLayout中编辑视图位置,请不要依赖通过Layout Editor进行拖放。您最好手动进行此操作,除非您以后要头痛。使用布局编辑器查看设计结果。
首先用纸或想象力进行设计,然后再进行编码。
尝试从以下方面学习它:
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句