admin管理员组文章数量:1240607
In the chat screen, LAYOUT1. When keyboard open the top view and recyclerview stays where they are and bottom Layout with edit text is adjusted. On redmi, poco and Samsung devices. But it doesn't work on pixel 7 device the keyboard appear on top of layout
<activity
android:name=".ActivityChat"
android:exported="true"
android:screenOrientation="portrait" />
when I use
android:windowSoftInputMode="adjustPan"
The entire layout is scroll up and bottom Layout is not fully visible. Edittext is focused. It doesn't look good for all devices. I want the first scenario on pixel 7.
Here is my XML code
<RelativeLayout xmlns:android=";
xmlns:app=";
android:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/bg_gradient">
<RelativeLayout
android:id="@+id/rlTop"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="@dimen/_40sdp">
<ImageView
android:id="@+id/imgBack"
android:layout_width="@dimen/_36sdp"
android:layout_height="match_parent"
android:layout_centerVertical="true"
android:layout_gravity="start"
android:paddingHorizontal="@dimen/_10sdp"
android:src="@drawable/back_arrow"
app:tint="@color/white" />
<ImageView
android:id="@+id/iconHistory"
android:layout_width="@dimen/_30sdp"
android:layout_height="match_parent"
android:layout_centerVertical="true"
android:layout_toStartOf="@id/iconEdit"
android:paddingHorizontal="@dimen/_7sdp"
android:src="@drawable/icon_history"
app:tint="@color/white" />
<ImageView
android:id="@+id/iconEdit"
android:layout_width="@dimen/_36sdp"
android:layout_height="match_parent"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:paddingHorizontal="@dimen/_10sdp"
android:src="@drawable/icon_edit"
app:tint="@color/white" />
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toEndOf="@id/imgBack"
android:text="Ask AI"
android:textColor="@color/white"
android:textSize="@dimen/_15ssp"
android:textStyle="bold" />
</RelativeLayout>
</RelativeLayout>
</RelativeLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_above="@id/rlBottom"
android:layout_below="@id/rlTop" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rvList"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/rlTop"
android:elevation="@dimen/_4sdp"
android:visibility="gone" />
<LinearLayout
android:id="@+id/rlBottom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#382E4C"
android:orientation="vertical">
<TextView
android:id="@+id/tvRetry"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="@dimen/_6sdp"
android:background="@drawable/bg_retry"
android:paddingHorizontal="@dimen/_8sdp"
android:paddingVertical="@dimen/_1sdp"
android:text="Retry"
android:textColor="@color/black"
android:visibility="gone" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="@dimen/_52sdp">
<ImageView
android:id="@+id/icon1"
android:layout_width="@dimen/_20sdp"
android:layout_height="match_parent"
android:layout_marginHorizontal="@dimen/_7sdp"
android:paddingHorizontal="@dimen/_1sdp"
android:src="@drawable/attach"
android:visibility="gone" />
<EditText
android:id="@+id/textBox"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginVertical="@dimen/_9sdp"
android:layout_marginStart="@dimen/_10sdp"
android:layout_toStartOf="@id/microphone"
android:layout_toEndOf="@id/icon1"
android:background="@drawable/stroke_eddittext"
android:hint="Whats on your mind?"
android:lines="1"
android:paddingHorizontal="@dimen/_15sdp"
android:singleLine="true"
android:textColor="@color/white"
android:textColorHint="@color/hintText"
android:textSize="@dimen/_11ssp" />
<ImageView
android:id="@+id/microphone"
android:layout_width="@dimen/_20sdp"
android:layout_height="match_parent"
android:layout_marginHorizontal="@dimen/_4sdp"
android:layout_toStartOf="@+id/send"
android:paddingHorizontal="@dimen/_3sdp"
android:src="@drawable/icon_microphone"
app:tint="@color/iconColor" />
<ImageView
android:id="@+id/send"
android:layout_width="@dimen/_22sdp"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginStart="@dimen/_4sdp"
android:layout_marginEnd="@dimen/_8sdp"
android:adjustViewBounds="true"
android:src="@drawable/img_send2" />
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
本文标签: androidAdjusting Layout when Softkeyboard open on pixel 7 devicesStack Overflow
版权声明:本文标题:android - Adjusting Layout when Softkeyboard open on pixel 7 devices - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1740012568a2220376.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论