0
A
回答
0
事情是這樣的:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Apellidos"/>
<EditText
android:id="@+id/editText"
android:layout_toRightOf="@+id/text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hind="Apellidos"/>
<LinearLayout
android:layout_below="@+id/editText"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_weight="1"
android:layout_marginRight="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:id="@+id/text2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="Ciudad"/>
<EditText
android:layout_toRightOf="@+id/text2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hind="Apellidos"/>
</RelativeLayout>
<RelativeLayout
android:layout_marginLeft="20dp"
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:id="@+id/text3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="Ciudad"/>
<EditText
android:layout_toRightOf="@+id/text3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hind="Apellidos"/>
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
編輯:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/name"
android:orientation="vertical"
android:gravity="right"
android:layout_width="wrap_content"
android:layout_height="match_parent">
<TextView
android:id="@+id/text"
android:padding="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Apellidos"/>
<TextView
android:id="@+id/text1"
android:padding="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Apelli"/>
</LinearLayout>
<LinearLayout
android:id="@+id/value"
android:orientation="vertical"
android:layout_toRightOf="@+id/name"
android:layout_width="match_parent"
android:layout_height="match_parent">
<EditText
android:id="@+id/editText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/text"
android:hind="Apellidos" />
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:layout_weight="2"
android:layout_toRightOf="@+id/text2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:hind="Apellidos"/>
<TextView
android:layout_marginLeft="10dp"
android:layout_weight="1"
android:id="@+id/text2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Ciudad"/>
<EditText
android:layout_weight="2"
android:layout_toRightOf="@+id/text2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:hind="xyz"/>
</LinearLayout>
</LinearLayout>
+0
這就是想法,但組件並不對齊 –
+0
你的意思是左側textview沒有被分配?如果是的話,你必須添加空格到文本,並使他們都是相同的長度 – khetanrajesh
+0
你是對的。我已經嘗試過它,但它工作,但我擔心當國際化發生 –
1
雖然你可以使用RelativeLayout的實現這一點,它是使用ConstraintLayout的理想人選,這將讓您指定元素位置相對於彼此以及在窗口在平板電腦或多窗口模式下調整大小時應如何擴展/重新定位。
相關問題
- 1. 如何在此表單中製作reCaptcha?
- 2. 在android studio上製作表格
- 3. 如何製作此邊框
- 4. 如何在Android上進行此佈局?
- 5. 如何在JDialog上製作表格
- 6. 如何製作單個實例表單
- 7. 如何在Flash中製作此動畫
- 8. 如何在CSS中製作此形狀?
- 9. 如何在graphviz中製作此圖?
- 10. 如何在html中製作此形狀?
- 11. 如何在unity3d中製作具有此效果的菜單?
- 12. 如何在Swing中繪製此圖表?
- 13. 如何在此上使用簡單的操作符?
- 14. jQuery製作表單消失並出現在彼此之後
- 15. 製作特定表單在多個表單上不可見
- 16. 如何讓此DialogBox在列表項上單擊彈出?
- 17. 如何在此數據上創建表?
- 18. 如何在Android的材料設計列表上製作圓形列表圖標?
- 19. 如何爲此Android項目製作自定義xml佈局?
- 20. 我該如何製作此自定義控件和Android
- 21. 如何製作此圖片中顯示的Android活動?
- 22. j2me表單(在Android上)
- 23. 如何製作表單字段?
- 24. 如何製作密碼更改表單?
- 25. 如何製作灰色的HTML表單?
- 26. 如何在頁面上製作單獨的菜單?
- 27. 如何將此div放置在此搜索表單下方?
- 28. 在表單上繪製點
- 29. 如何僅使用ul,li和css來製作此菜單?
- 30. 如何使用HTML和CSS製作此菜單
你應該發佈你迄今爲止所做的。幫助更容易。 – davidxxx
對不起! Stackoverflow說我至少需要10分才能上傳圖片。我目前是6. –