Alignparentbottom = true охватывает весь экран в относительном макете - PullRequest
0 голосов
/ 16 мая 2018

Я хочу создать макет, как макет обмена сообщениями WhatsApp.Отредактируйте текст и отправьте значок внизу и список над ними.Edittext может многострочным, и я хочу, чтобы значок всегда внизу (image).Но когда я делаю ImageView alignparentbottom = true bottomRl покрывает весь экран (image).

 <RelativeLayout 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">

         // recyclerview here , above the bottom view 

          <RelativeLayout
                android:id="@+id/bottomRl"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_alignParentBottom="true">

                <EditText
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content" />

                <ImageView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentBottom="true"
                    android:src="@drawable/ic_test" />

            </RelativeLayout>
    </RelativeLayout>

Это ошибка андроида или я что-то не так делаю?

Спасибо за ответы

Решение ...

<ImageView
            android:id="@+id/imageViewSend"
            android:layout_width="36dp"
            android:layout_height="36dp"
            android:layout_alignBottom="@+id/editTextEntry"
            android:layout_alignParentEnd="true"
            android:src="@drawable/ic_send" />

Ответы [ 2 ]

0 голосов
/ 16 мая 2018

попробуй так:

<RelativeLayout 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.support.v7.widget.RecyclerView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

    <RelativeLayout
        android:id="@+id/bottomRl"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true">

        <EditText
            android:id="@+id/editTxt"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_toStartOf="@id/imageV"
            android:text="vsdvsvsvsv c xc x x xdfbdcx  fv"/>

        <ImageView
            android:id="@+id/imageV"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentEnd="true"
            android:src="@mipmap/ic_launcher" />

    </RelativeLayout>
</RelativeLayout>
0 голосов
/ 16 мая 2018

попробуй, android:layout_alignBottom="@+id/edittext"

<RelativeLayout
    android:id="@+id/bottomRl"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_alignParentBottom="true">

    <EditText
        android:id="@+id/edittext"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

    <ImageView
        android:padding="5dp"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/ic_menu_camera"
        android:layout_alignBottom="@+id/edittext"
        android:layout_alignParentRight="true"
        android:layout_alignParentEnd="true" />

</RelativeLayout>
...