11
A
回答
2
我usedthe如下代碼,但它仍然有一些不足之處:你應該修改值:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/widget"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|center_vertical"
>
<EditText
android:id="@+id/bullet"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingRight="4dip"
android:includeFontPadding="false"
android:lines="4"
android:text="hidhidihfidhfdifhdifhdifhidhfidf" />
<ImageView
android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#ffff00"
android:src="@drawable/icon"
android:layout_alignTop="@id/bullet"
android:layout_marginLeft="50dip" />
<ImageView
android:id="@+id/icon1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#ff00ff"
android:layout_alignBottom="@id/bullet"
android:layout_marginLeft="100dip"
android:src="@drawable/star_logo" />
</RelativeLayout>
1
@pengwang和人可能關注
基線是指線在任何視圖的底部,按鈕,圖像視圖或任何控件。當你使用基線屬性時,你給出了你想要引用的基地的任何標識,或者是你想要的按鈕或任何地方。當您切換到圖形視圖,它會告訴它如何爲不會忽略你已經定義
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<RelativeLayout
android:id="@+id/relativeLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<ImageButton
android:id="@+id/iB"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher"
android:layout_alignParentBottom="true" />
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button"
android:layout_alignParentBottom="true"
android:layout_toRightOf="@id/iB"
android:layout_alignBaseline="@id/relativeLayout1" />
</RelativeLayout>
</LinearLayout>
0
做這樣的事情
<EditText
android:id="@+id/searchedittext"
android:layout_width="fill_parent"
android:layout_height="50dip"
android:hint="Search Events, Restaurants, Businesses"
android:singleLine="true"
android:textSize="15dip" />
<Button
android:id="@+id/searchbtn"
android:layout_width="40dip"
android:layout_height="40dip"
android:layout_marginLeft="-50dip"
android:background="@drawable/ic_menu_search" />
<Button
android:id="@+id/searchbtn2"
android:layout_width="40dip"
android:layout_height="40dip"
android:layout_marginLeft="-30dip"
android:background="@drawable/ic_menu_search" />
</LinearLayout>
-1
基線放置您的觀察中心的父視圖您只需指定此屬性 android:gravity =「center」
相關問題
- 1. 如何在RelativeLayout中將視圖與無邊距的另一個視圖對齊?
- 2. 對齊Gridview與另一個視圖
- 3. 如何將視圖(如在RelativeLayout中)與侄子視圖對齊?
- 4. 使用FLKAutoLayout對齊另一個視圖旁邊的視圖
- 5. 如何在LinearLayout中對齊視圖
- 6. Android - 在代碼中將另一個視圖中的視圖(按鈕)對齊?
- 7. 在Android中對齊兩個文本視圖的基線
- 8. 在ViewFlipper中對齊視圖
- 9. Android RelativeLayout對齊另一個視圖右上角的一個視圖的中心
- 10. 對另一個視圖進行視圖
- 11. 如何在相對佈局中對齊父視圖中居中的視圖
- 12. 如何將子視圖與父視圖的中心對齊?
- 13. 如何在列表視圖爲空時對齊文本視圖?
- 14. 如何在另一個線程之間切換視圖?
- 15. 如何居中對齊視圖?
- 16. 如何按中心點對齊視圖?
- 17. 如何對齊2個視圖中的1個視圖上的視圖
- 18. 如何在LinearLayout中對齊視圖對齊?
- 19. 機器人對齊視圖到視圖
- 20. 如何對齊android中同一底線的兩個圖像視圖?
- 21. 如何在couchdb視圖中調用另一個視圖?
- 22. 如何在另一個視圖中獲取視圖的框架?
- 23. 如何在android中添加視圖到另一個視圖?
- 24. 如何在cakephp的另一個視圖中包含視圖
- 25. 如何對齊文本視圖圖像兩者之間低於
- 26. 視圖和部分視圖之間的對齊問題
- 27. 在桌面視圖和移動視圖對齊中心右側的CSS對齊
- 28. 如何在一個視圖和另一個視圖之間製作動畫uitabbarcontroller
- 29. 如何實現滾動視圖與視圖頂部對齊?
- 30. 基於同一視圖中的另一列在SQL視圖中插入總和