不同的對象我想有同一行中一個EditText和按鈕。
那麼爲什麼我把<LinearLayout android:orientation="horizontal"...>
但我也有一個TextView,我不希望該TextView出現在EditText和按鈕相同的行。
感謝您的幫助。如何訂購接口
Q
如何訂購接口
1
A
回答
1
你可以通過很多方式來做到這一點。
- 線性佈局
- 相對佈局
- 表佈局。
使用線性佈局 - 您可以在頂部放置一個線性佈局'A'並將其方向設置爲「垂直」。現在把兩個子節點放在一個新的線性佈局「B」和一個文本視圖中。 在新的線性佈局設置它的方向「水平」,然後在其中添加按鈕,EditText上。
以下是代碼:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<EditText
android:text="EditText"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:width="250dp"></EditText>
<Button
android:text="Button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"></Button>
</LinearLayout>
<TextView
android:text="TextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</TextView>
</LinearLayout>
0
嘗試在你的XML使用RelativeLayout
。
相關問題
- 1. 如何訂購預購表
- 2. MySQL - 如何訂購連接表?
- 3. 如何訂購HashList?
- 4. 如何訂購DataColumns?
- 5. 如何訂購JSONArray?
- 6. 如何訂購與tslint進口排序規則的進口
- 7. 構造鏈接訂購
- 8. 如何通過特定訂單訂購?
- 9. 如何訂購,團體,訂單與MySQL
- 10. 如何「desc」訂購group_by?
- 11. 如何訂購刻面?
- 12. 如何訂購空值?
- 13. 如何通過GenericForeignKey訂購?
- 14. 如何訂購清單
- 15. 如何在AngularJS中訂購
- 16. 如何訂購複製
- 17. 如何訂購NUnit測試
- 18. 如何訂購兩列
- 19. 如何訂購的時間
- 20. 如何按總和訂購
- 21. 如何訂購此查詢?
- 22. 如何使用DESC訂購
- 23. 如何在SQL中訂購
- 24. Firebase - 如何訂購商品?
- 25. 如何訂購CSS屬性?
- 26. 如何訂購流合併?
- 27. 如何訂購樞軸?
- 28. 如何訂購表格?
- 29. scala如何訂購元組?
- 30. 如何訂購串邏輯