user2269164
user2269164

Reputation: 1105

image overlapping edittext while typing

I have an edittext and below to that imageview followed by 3 textviews. when i try to type in the edittext the 3 textview are displaying properly. But when i add the image and try typing in the edittext the image is displaying on top of edittext means image is overlapping the edittext.

XML:

<ScrollView
  xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:fillViewport="true"
  android:background="#ffffffff">



<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
    android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".Main"
    android:paddingStart="5dp">

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/userDisplay"
        android:text="Username"
        android:textColor="#ff6aa9ff"
        android:textSize="20sp"
        android:textStyle="bold"/>

    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/FName"
        android:hint="FName"
        android:background="#ffffffff"
        android:gravity="start|left"
        android:inputType="textFilter|textMultiLine"
        android:maxLength="150"

        android:layout_alignParentRight="true"
        android:layout_alignParentEnd="true"
        android:layout_below="@+id/userDisplay" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:text="Camera"
        android:id="@+id/Camera"
        android:paddingTop="7dp"
        android:paddingBottom="7dp"
        android:background="#ffffffff"
        android:textSize="21sp"
        android:drawableLeft="@drawable/compact"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:text="Gallery"
        android:id="@+id/Gallery"
        android:paddingTop="7dp"
        android:paddingBottom="7dp"
        android:paddingLeft="7dp"
        android:background="#ffffffff"
        android:drawableLeft="@drawable/gallery"
        android:textSize="21sp"
        android:layout_alignTop="@+id/Camera"
        android:layout_centerHorizontal="true"
        android:layout_alignBottom="@+id/Camera" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:text=" Post"
        android:id="@+id/Post"
        android:paddingTop="7dp"
        android:paddingBottom="7dp"
        android:paddingLeft="5dp"
        android:paddingRight="5dp"
        android:background="#ffff5654"
        android:textSize="21sp"
        android:textStyle="bold"
        android:textColor="#ff000000"
        android:drawableLeft="@drawable/plane"
        android:layout_alignTop="@+id/Gallery"
        android:layout_alignParentRight="true"
        android:layout_alignBottom="@+id/Gallery" />

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="180dp"
        android:id="@+id/image"
        android:contentDescription="@string/abc_action_bar_home_description"
        android:layout_marginBottom="76dp"
        android:layout_alignParentBottom="true"
        android:layout_alignParentRight="true"
        android:layout_alignParentEnd="true" />


</RelativeLayout>
 </ScrollView>

and in the Android manifest file i do mention the below line the activity. Tried by removing the below line but same behavior is seen.

android:windowSoftInputMode="stateHidden|adjustResize"

What changes can i do to avoid this

Upvotes: 0

Views: 707

Answers (2)

Deep Dave
Deep Dave

Reputation: 157

Use LinearLayout with orientation="vertical" if you dont want to overlap image and texts ..

or

If you want to overlap TextViews and Edittext over Image try to put Imageview in Beginning of Relative layout or set it in background of RelativeLayout .

Upvotes: 0

come
come

Reputation: 11

if you want that you'r image will be "under" your edittext ,put the image in First position

like

RelativeLayout  
 ImageView  
 EditText 
 EditText
 EditText
RelativeLayout

after if you want that everything has the same moove put everthing inside a LinearLayout like

   RelativeLayout 
     ImageView  
    LinearLayout 
     EditText 
     EditText
     EditText
    LinearLayout 
   RelativeLayout

something like that

Upvotes: 1

Related Questions