[英]aligning button to bottom within linearlayout parent with minheight
[英]Android xml ,2 button use minheight in a LinearLayout and 2 button is not in a line
像這樣的xml
<Linearlayout
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:orientation="horizontal">
<Button
android:layout_height="wrap_content"
android:layout_width="0dp"
android:layout_weight="1"
android:minHeight="40dp"
...../>
<Button
android:layout_height="wrap_content"
android:layout_width="0dp"
android:layout_weight="1"
android:minHeight="40dp"
...../>
<LinearLayout/>
我希望兩個按鈕對齊,但是就像上面的圖片一樣。
當我刪除最小高度時,
所以任何人都知道為什么Minheight會使右按鈕稍微降低一點。
我寧願使用RelativeLayout,因為您對元素有更多的控制權。
如果沒有幫助,則將android:layout_alignParentRight =“ true”添加到您樂意放在右側的按鈕上,然后將您想要的按鈕添加到左側android:layout_toLeftOf =“ @ + id / LocationIDdb ”,其中包含您設置為向右對齊的ID。
您對所有視圖使用了錯誤的屬性,請嘗試這種方式,希望這將幫助您解決問題。
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:layout_height="wrap_content"
android:layout_width="0dp"
android:layout_weight="1"
android:minHeight="40dp"/>
<Button
android:layout_height="wrap_content"
android:layout_width="0dp"
android:layout_weight="1"
android:minHeight="40dp"/>
</LinearLayout>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.