gpt4 book ai didi

android - 如何修复我的线性布局底部的按钮 : Android Studio

转载 作者:行者123 更新时间:2023-11-29 15:39:24 24 4
gpt4 key购买 nike

我的 UI 上有一个 ImagePickerButtonEditTextSend 按钮,如下所示:

enter image description here

The problem is with the Send Button which doesn't fix to the bottom of my Linear Layout. Can anyone say how to make the position of the button fixed to the bottom when I type multi line text.

这是我的布局代码:

<?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>

最佳答案

尝试使用

android:baselineAligned="false"

在您的 LinearLayout 中。请让我知道这对你有没有用。这就是我解决类似问题的方法,但它不包含 editText

关于android - 如何修复我的线性布局底部的按钮 : Android Studio,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43565042/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com