簡體   English   中英

alignparentbottom = true覆蓋了相對布局中的整個屏幕

[英]Alignparentbottom=true covers whole screen in relativelayout

我想創建類似whatsapp消息傳遞布局的布局。 編輯文本並發送圖標底部和上方的列表。 Edittext可以多行顯示,我想始終在底部找到圖標 (圖片) 但是當我使ImageView alignparentbottom = true bottomRl覆蓋整個屏幕時 (圖片)

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

這是Android錯誤還是我做錯了什么?

謝謝答案

解決方案...

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

嘗試, 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>

嘗試這樣:

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM