我有一个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>