我正在构建一个消息应用程序,并在多个对话之间使用viewPager标签。我在包含聊天消息的viewPager中扩充了布局中的RecyclerView。我还在布局的底部有一个EditText向RecyclerView添加消息。但是,当我向适配器添加新消息时,它被editText覆盖。我希望消息保持在输入EditText上,就像在其他常见的消息应用程序中一样。RecyclerView in viewPager above EditText
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/appbar_padding_top"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay">
</android.support.v7.widget.Toolbar>
<android.support.design.widget.TabLayout
android:id="@+id/conversation_tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
/>
<include layout="@layout/input_bar"/>
</android.support.design.widget.CoordinatorLayout>
和布局的EditText
<LinearLayout
android:background="@color/input_background"
android:id="@+id/inputLL"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_alignParentBottom="true"
android:orientation="horizontal" >
<EditText
android:id="@+id/input"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_margin="@dimen/input_editText_margin"
android:maxLines="2"
android:hint="Type your message..."
android:background="@android:color/transparent"
>
</EditText>
<LinearLayout
android:id="@+id/send_container"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="@drawable/input_button_selector"
android:clickable="true"
>
<ImageButton
android:id="@+id/send"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_send_black_24dp"
android:background="@android:color/transparent"
android:layout_margin="@dimen/input_send_margin"
android:layout_gravity="bottom"
/>
</LinearLayout>
</LinearLayout>
请使用EditText发布您的xml代码。 – amitairos