我正在構建一個消息應用程序,並在多個對話之間使用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