[英]Is it possible to move a view to the bottom-left-most corner in a LinearLayout?
所以,這是我的觀點
與XML代碼:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="16dp">
<TextView
style="?android:listSeparatorTextViewStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/crime_title_label" />
<EditText
android:id="@+id/crime_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/crime_title_hint" />
<TextView
style="?android:listSeparatorTextViewStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/crime_details_label" />
<Button
android:id="@+id/crime_date"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<CheckBox
android:id="@+id/crime_solved"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/crime_solved_label" />
</LinearLayout>
我想在最左下角添加一個按鈕。 但是我不確定在垂直方向的線性布局中是否可以實現。 我想到的唯一不更改布局類型的方法就是將這部分添加到我想要的按鈕中: android:layout_gravity="bottom|left"
但這並不能解決問題。 有什么建議么? 如果可以在線性布局中解決該問題,我將非常高興。
我認為這是最短的解決方案,盡管我無法想到沒有其他布局。 將其添加到xml的末尾(仍在LinearLayout中)。
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom" />
</FrameLayout>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.