我有一个自定义的ListView
+(发送消息的控件
)布局,用于发送消息和显示聊天。问题是 ListView
的最后一个单元格不完全可见(它就像在用于写入和发送消息的蓝色控件后面):
我已经将以下内容添加到我的 Manifest
文件中:
android:windowSoftInputMode="stateVisible|adjustResize"
这是我的 xml 布局文件:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ListView
android:id="@+id/listView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<RelativeLayout
android:id="@+id/footer_layout"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:background="@color/color_custom_light_blue"
android:orientation="horizontal" >
<EditText
android:id="@+id/editText"
android:layout_width="250dp"
android:layout_height="match_parent"
android:layout_centerVertical="true"
android:layout_margin="3dp"
android:background="@drawable/rounded_edittext"
android:hint="@string/message_list_edittext_hint"
android:lines="2"
android:padding="5dp"
android:textSize="17sp"
android:textStyle="normal" />
<ImageButton
android:id="@+id/clearButton"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_centerVertical="true"
android:layout_gravity="right|center_vertical"
android:layout_margin="3dp"
android:layout_toRightOf="@id/editText"
android:background="@drawable/clear_button_selector"
android:contentDescription="@string/clear_button_content_description"
android:onClick="clearLetterClicked" />
<Button
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_centerVertical="true"
android:layout_margin="3dp"
android:layout_toRightOf="@id/clearButton"
android:onClick="sendClicked"
android:text="@string/message_list_edittext_send"
android:textColor="@color/white"
android:textSize="17sp" />
</RelativeLayout>
</RelativeLayout>
因此,我希望当我滚动到带有聊天消息的 ListView
末尾时,最后一个单元格变得可见。
最佳答案
您应该在页脚布局之后定义您的ListView。
该容器是一个RelativeLayout,因此您可以将ListVew设置为ABOVE页脚布局。
还将其高度设置为FILL_PARENT。
所以,它不会被它覆盖。它会在页脚开始之前停止增长。
轻松修复,发挥技巧。
关于android - 最后一个单元格在自定义 Android ListView 布局中不可见,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21098342/