I have spent a whole day researching on how to achieve this. I have a scrollview, an edittext below it and a button to the right of the edittext.
1) I am trying to move all these contents upwards as the keyboard appears without any of the views overlapping.
I have tried different solutions like margin, padding, windowsoftinputMode, changing my layout in different ways but I couldn't still achieve this. Please Help me! This is my code:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.Toolbar
android:id="@+id/detailsToolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/colorToolbar"
android:elevation="4dp"
android:theme="@style/Toolbar_iconTheme" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/detailsToolbar"
android:orientation="vertical">
<ScrollView
android:id="@+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/displayPicture"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxHeight="100dp"
android:maxWidth="80dp"
android:minHeight="80dp"
android:minWidth="70dp"
android:padding="4dp"
android:src="@mipmap/ic_launcher_round" />
<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_toRightOf="@+id/displayPicture"
android:paddingLeft="4dp"
android:paddingTop="4dp"
android:text="ProfileName"
android:textAppearance="@style/Base.TextAppearance.AppCompat.Large"
android:textColorHighlight="@android:color/holo_blue_dark"
android:textSize="16sp" />
<TextView
android:id="@+id/post"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/name"
android:layout_toRightOf="@+id/displayPicture"
android:padding="4dp" />
<TextView
android:id="@+id/commentsline"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/displayPicture"
android:background="@android:color/darker_gray"
android:padding="4dp"
android:text="comments"
android:textAlignment="center" />
<android.support.v7.widget.RecyclerView
android:id="@+id/commentsListView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/commentsline" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:orientation="horizontal">
<RelativeLayout
android:id="@+id/messageText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginRight="32dp"
android:background="@drawable/rounded_corners"
android:scrollbars="vertical" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:src="@android:drawable/ic_menu_send" />
</RelativeLayout>
</LinearLayout>
and Manifest:
<activity
android:name=".DetailsActivity"
android:windowSoftInputMode="adjustResize"/>