마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

리사이클러뷰 ui 질문

0 추천

리사이클러뷰의 내용이 많아지면 아래에 있는 EditText 와 Button 이 사라져요....

내용이 많아도 아래에 있는 EditText 와 Button 는 항상 아래에 있도록 하고싶어요...

간단할 것 같은데 어떻게 해야 하는지 모르겠어요...

 

 

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".navigation.CommentActivity">

    <androidx.appcompat.widget.Toolbar
        android:id="@+id/my_toolbar"
        android:layout_width="match_parent"
        android:layout_height="35dp">

        <ImageView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:src="@drawable/pswoo1" />
    </androidx.appcompat.widget.Toolbar>

    <LinearLayout
        android:id="@+id/toolbar_division"
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:background="@color/white"
        android:orientation="horizontal" />

    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/comment_recyclerview"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="8dp"
        android:layout_marginBottom="30dp" />

    <LinearLayout
        android:id="@+id/rel"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="bottom">
        <EditText
            android:id="@+id/comment_edit_message"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="10dp"
            android:layout_toLeftOf="@+id/comment_btn_send"
            android:layout_weight="1"/>
        <Button
            android:id="@+id/comment_btn_send"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_margin="8dp"
            android:text="send" />

    </LinearLayout>

</LinearLayout>

 

개미1 (1,260 포인트) 님이 2022년 6월 24일 질문

1개의 답변

0 추천

아래와 같이 레이아웃을 수정해 보세요.

<androidx.recyclerview.widget.RecyclerView
        android:id="@+id/comment_recyclerview"
        ..
        android:layout_height="0dp"
        android:layout_weight="1"
        ... />

    <LinearLayout
        android:id="@+id/rel"
      ...
        android:layout_height="wrap_content"> 

 

그리고 툴바의 표준 높이는 actionBarSize라는 속성에 정의되어 있으므로 가능하다면 그걸 사용하시기를 권장합니다.

    <androidx.appcompat.widget.Toolbar
        android:id="@+id/my_toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"> 
 
       ...
    </androidx.appcompat.widget.Toolbar>
 

 

 

spark (226,420 포인트) 님이 2022년 6월 24일 답변
spark님이 2022년 6월 25일 수정
...