gpt4 book ai didi

android - 带有 RecyclerView 的 LinearLayout 在键盘显示时会缩小吗?

转载 作者:太空狗 更新时间:2023-10-29 14:41:19 25 4
gpt4 key购买 nike

您好,我有两个 recyclerView 和一个底 View 。当我在 recyclerView 中单击一个项目时,应该会出现一个带有 editText 的弹出窗口。当我触摸 editText 时,键盘被触发,线性布局被推高。我不想向上推键盘应该在屏幕上方可见的布局。

XML代码

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:isScrollContainer="false">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/relative_layout"
android:orientation="vertical">

<include layout="@layout/app_toolbar" />

<View
android:layout_width="match_parent"
android:layout_height="@dimen/margin_1dp"
android:background="@color/black_color_10_percent" />

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black_color_2_percent">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<RelativeLayout
android:id="@+id/tool_tip_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:background="@color/color_white"
android:gravity="center_vertical"
android:padding="5dp">

<TextView
android:id="@+id/text_view_user_tool_tip_label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/margin_10dp"
android:layout_toLeftOf="@+id/image_view_remove_tool_tip"
android:gravity="center|left"
android:singleLine="true"
android:textColor="@color/icon_un_selected_color"
android:textSize="@dimen/text_size_12dp" />

<ImageView
android:id="@+id/image_view_remove_tool_tip"
android:layout_width="@dimen/margin_24dp"
android:layout_height="@dimen/margin_24dp"
android:layout_alignParentRight="true"
android:layout_gravity="right|center_vertical"
android:layout_marginRight="@dimen/margin_10dp"
android:background="@drawable/circle_grey_bg"
android:padding="@dimen/margin_6dp"
android:src="@drawable/ic_close_white_24dp" />

</RelativeLayout>

<android.support.v7.widget.CardView
android:id="@+id/card_view_your_suggestions"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2"
app:cardBackgroundColor="@color/light_grey_color"
app:cardCornerRadius="0dp"
app:cardElevation="0.5dp"
app:cardMaxElevation="1dp"
app:cardPreventCornerOverlap="true"
app:cardUseCompatPadding="true"
app:contentPaddingBottom="0dp">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<TextView
android:layout_width="match_parent"
android:layout_height="@dimen/margin_40dp"
android:background="@color/color_grey"
android:gravity="center|left"
android:paddingLeft="@dimen/margin_12dp"
android:text="@string/text_your_selections"
android:textColor="@color/black_color_87_percent"
android:textSize="@dimen/text_size_14dp" />

<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view_your_selection_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="none" />

</LinearLayout>

</android.support.v7.widget.CardView>

<android.support.v7.widget.CardView
android:id="@+id/card_view_suggestions"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="@dimen/margin_6dp"
android:layout_weight="3"
android:background="@android:color/white"
app:cardCornerRadius="0dp"
app:cardElevation="0dp"
app:cardMaxElevation="1dp"
app:cardPreventCornerOverlap="true"
app:cardUseCompatPadding="true"
app:contentPaddingBottom="0dp">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<TextView
android:layout_width="match_parent"
android:layout_height="@dimen/margin_40dp"
android:background="@color/color_grey"
android:gravity="center|left"
android:paddingLeft="@dimen/margin_12dp"
android:text="@string/text_your_suggestions"
android:textColor="@color/black_color_87_percent"
android:textSize="@dimen/text_size_14dp" />

<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view_your_suggestion_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
android:fadeScrollbars="false"
android:scrollbarThumbVertical="@drawable/scrollbar_thumb"
android:scrollbarTrackVertical="@drawable/scrollbar_track"
android:scrollbars="vertical" />

</LinearLayout>

</android.support.v7.widget.CardView>

<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="@dimen/margin_8dp"
android:layout_weight="1.1"
android:visibility="gone"
app:cardBackgroundColor="@color/light_grey_color"
app:cardCornerRadius="0dp"
app:cardElevation="0dp"
app:cardMaxElevation="1dp"
app:cardPreventCornerOverlap="true"
app:cardUseCompatPadding="true"
app:contentPaddingBottom="0dp">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<TextView
android:layout_width="match_parent"
android:layout_height="@dimen/margin_40dp"
android:background="@color/colorPrimaryDark"
android:gravity="center|left"
android:paddingLeft="@dimen/margin_12dp"
android:text="@string/text_add_new"
android:textColor="@color/black_color_87_percent"
android:textSize="@dimen/text_size_14dp" />

<abihealth.emrappabi.widgets.MyCustomTextView
android:id="@+id/text_view_add_new_element"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="@dimen/margin_8dp"
android:background="@drawable/edit_text_bg"
android:maxLines="1"
android:paddingLeft="@dimen/margin_8dp" />

</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
</RelativeLayout>
</LinearLayout>

<RelativeLayout
android:id="@+id/relative_layout"
android:layout_width="match_parent"
android:layout_height="@dimen/margin_40dp"
android:layout_alignParentBottom="true"
android:background="@color/color_grey">

<LinearLayout
android:id="@+id/add_new_phrase_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="@dimen/margin_6dp"
android:background="@android:color/white"
android:gravity="center_vertical"
android:orientation="horizontal">

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/margin_6dp"
android:src="@drawable/icon_add_drawable" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center|left"
android:paddingLeft="@dimen/margin_2dp"
android:text="@string/text_add_phrase"
android:textColor="@color/black_54_percent"
android:textSize="@dimen/text_size_14dp" />

</LinearLayout>
</RelativeLayout>
</RelativeLayout>

Layout should not pushed up

最佳答案

添加到 list 中的 Activity ,这对我有用

<activity
...
android:windowSoftInputMode="adjustNothing">
</activity>

关于android - 带有 RecyclerView 的 LinearLayout 在键盘显示时会缩小吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47868023/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com