我有一個ImagePickerButton
,如下圖所示EditText
和Send
按鈕在我的UI:如何在我的線性佈局底部的固定按鈕:Android Studio中
的問題是與
Send
按鈕不能固定在我的線性佈局的底部 。任何人都可以說當我輸入多行文本時,如何將 按鈕的位置固定爲底部。
這是我的佈局代碼:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/relativeLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:maxWidth="@android:dimen/notification_large_icon_height"
tools:context="com.pc.wecare.MainActivity">
<ListView
android:id="@+id/messageListView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/linearLayout"
android:divider="@color/cardview_dark_background"
android:stackFromBottom="true"
android:transcriptMode="alwaysScroll"
tools:listitem="@layout/item_message" />
<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="bottom"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:orientation="horizontal">
<ImageButton
android:id="@+id/photoPickerButton"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_gravity="bottom"
android:background="@android:drawable/ic_menu_gallery" />
<EditText
android:id="@+id/messageEditText"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_weight="1"/>
<Button
android:id="@+id/sendButton"
android:layout_width="wrap_content"
android:layout_height="35dp"
android:layout_gravity="bottom"
android:enabled="false"
android:text="SEND" />
</LinearLayout>
</RelativeLayout>