gpt4 book ai didi

android - Edittext 和一个按钮后跟回收站 View

转载 作者:太空狗 更新时间:2023-10-29 16:11:50 25 4
gpt4 key购买 nike

我有一个带有 RelativeLayoutRecyclerView 的空 Activity

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:="match_parent"
android:layout_height="match_parent"
app:layout_behavilayout_widthor="@string/appbar_scrolling_view_behavior"
tools:showIn="@layout/activity_main"
tools:context=".MainActivity">

<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</RelativeLayout>

我需要在 RecyclerView 之前添加一个 EditText 和一个按钮。 我想 RecyclerView 的 填充高度应该改变但不确定!请帮助我

最佳答案

试试这个。将您的父布局设为线性布局,您的 View 将堆叠。

<?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="5dp">

<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<EditText
android:id="@+id/editText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textPersonName"
android:text="Name"
android:layout_toStartOf="@+id/button" />

<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button"
android:layout_alignParentEnd="true"/>
</RelativeLayout>

<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>

关于android - Edittext 和一个按钮后跟回收站 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45208123/

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