Alignparentbottom=true 在相对布局中覆盖整个屏幕
Alignparentbottom=true covers whole screen in relativelayout
我想创建类似于 whatsapp 消息布局的布局。编辑文本并在底部发送图标并在其上方列出。 Edittext 可以多行,我想始终将图标定位在底部 . But when I make ImageView alignparentbottom=true bottomRl cover the whole screen 。
<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>
我想创建类似于 whatsapp 消息布局的布局。编辑文本并在底部发送图标并在其上方列出。 Edittext 可以多行,我想始终将图标定位在底部
<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>