当键盘出现android时,工具栏会向上移动

时间:2018-04-05 10:59:21

标签: android android-layout

键盘出现时工具栏向上移动我不知道为什么我使用adjustresize和adjustPan但问题仍然存在。当我打开键盘工具栏移动时聊天屏幕应用程序有聊天问题。请检查此代码并指出错误。当我用户调整没有键盘打开但edittext保持在底部 在此先感谢:)

<?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"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="group.chat.live.share.message1.Main3Activity">

    <android.support.v7.widget.Toolbar
        android:layout_width="match_parent"
        android:layout_height="@dimen/_50sdp"
        android:layout_gravity="center_horizontal"
        android:gravity="center_vertical|left"
        android:id="@+id/firstlayout"
        android:fitsSystemWindows="true"
        android:background="@drawable/navbar_bg">

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@drawable/left"
                android:id="@+id/more"
                android:layout_marginTop="@dimen/_3sdp"
                android:textColor="@android:color/white"/>

            <de.hdodenhof.circleimageview.CircleImageView
                android:layout_width="@dimen/_25sdp"
                android:layout_height="@dimen/_25sdp"
                android:layout_marginRight="@dimen/_10sdp"
                android:layout_marginLeft="@dimen/_25sdp"
                android:src="@drawable/defaultttii"
                android:id="@+id/addgroup2" />

            <TextView
                android:id="@+id/qaqa"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="asdasdasds"
                android:layout_marginLeft="@dimen/_55sdp"
                android:paddingRight="@dimen/_5sdp"
                android:layout_marginTop="@dimen/_3sdp"
                android:textColor="@android:color/white"
                android:textSize="@dimen/_13sdp" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/logout"
                android:text="Logout"
                android:layout_alignParentRight="true"
                android:layout_marginRight="@dimen/_12sdp"
                android:textSize="@dimen/_13sdp"
                android:textColor="@android:color/white"/>

        </RelativeLayout>
    </android.support.v7.widget.Toolbar>



    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_above="@+id/thidlayout"
        android:layout_below="@+id/firstlayout"
        android:background="#E0E0E0"
        android:layout_marginBottom="@dimen/_5sdp"
        android:id="@+id/secondlayout">


        <com.google.android.gms.ads.AdView
            android:id="@+id/adview1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
            app:adSize="BANNER"
            app:adUnitId="@string/banner_home_footer">
        </com.google.android.gms.ads.AdView>


        <android.support.v7.widget.RecyclerView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="#E0E0E0"
            android:paddingTop="@dimen/_5sdp"
            android:paddingBottom="@dimen/_15sdp"
            android:layout_alignParentStart="true"
            android:dividerHeight="16dp"
            android:layout_below="@+id/adview1"
            android:stackFromBottom="true"
            android:visibility="gone"
            android:transcriptMode="alwaysScroll"
            android:divider="@android:color/transparent"
            android:id="@+id/list_of_messages" />

    </RelativeLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        android:background="@drawable/spinner"
        android:layout_alignParentBottom="true"
        android:orientation="horizontal"
        android:id="@+id/thidlayout">


        <EditText
            android:id="@+id/input"
            android:layout_width="wrap_content"
            android:layout_height="@dimen/_40sdp"
            android:layout_alignParentStart="true"
            android:layout_alignParentTop="true"
            android:layout_marginStart="7dp"
            android:layout_weight="10"
            android:backgroundTint="@android:color/transparent"
            android:hint="Type  your message"
            android:paddingLeft="@dimen/_5sdp" >

        </EditText>

        <Button
            android:layout_width="@dimen/_35sdp"
            android:layout_height="@dimen/_30sdp"
            android:clickable="true"
            android:layout_marginRight="@dimen/_10sdp"
            android:id="@+id/fab"
            android:background="@drawable/sendbutton"
            android:layout_marginBottom="@dimen/_5sdp"
            android:layout_alignParentBottom="true"
            android:layout_alignParentEnd="true"
            android:layout_alignParentRight="true"/>

        <Button
            android:layout_width="@dimen/_40sdp"
            android:layout_height="@dimen/_40sdp"
            android:id="@+id/addimage"
            android:background="@drawable/add"
            android:layout_marginRight="@dimen/_3sdp"/>

    </LinearLayout>

</RelativeLayout>

image of chat screen

0 个答案:

没有答案