Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Move Android Edittext little bit upwards when focus on to it

I have a multiline Edittext. When user touch it to type it shows half of it. Soft Keyboard covers the rest. I need it to be viewed fully.

This is how it shows now.

enter image description here

I want it to look like this.

enter image description here

I have used both adjustPan & adjustResize for android:windowSoftInputMode but nothing changed.

This is my XML layout.

    <RelativeLayout
    android:id="@+id/base"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@drawable/bg_type"
    android:keepScreenOn="true"
    android:orientation="vertical" >

    <ImageView
        android:id="@+id/own"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:layout_marginLeft="120dp"
        android:layout_marginTop="160dp"
        android:contentDescription="@string/image"
        android:src="@drawable/own" />

    <ImageView
        android:id="@+id/a"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignTop="@+id/own"
        android:layout_marginLeft="75dp"
        android:layout_toRightOf="@+id/own"
        android:contentDescription="@string/image"
        android:src="@drawable/a_pressed" />

    <ImageView
        android:id="@+id/b"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignTop="@+id/a"
        android:layout_marginLeft="20dp"
        android:layout_toRightOf="@+id/a"
        android:contentDescription="@string/image"
        android:src="@drawable/b" />

    <ImageView
        android:id="@+id/c"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignTop="@+id/b"
        android:layout_marginLeft="20dp"
        android:layout_toRightOf="@+id/b"
        android:contentDescription="@string/image"
        android:src="@drawable/c" />

    <FrameLayout
        android:id="@+id/txtlayer"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerVertical="true"
        android:layout_marginLeft="160dp" >

        <com.empite.telegramstop.Txt
            android:id="@+id/txt"
            style="@style/blue_edittext"
            android:layout_width="820dp"
            android:layout_height="200dp"
            android:gravity="top"
            android:imeOptions="actionNext"
            android:inputType="textMultiLine"
            android:nextFocusLeft="@id/txt"
            android:nextFocusUp="@id/txt"
            android:padding="10dp"
            android:text="@string/msg_a"
            android:textSize="25dp"
            android:textStyle="bold"
            android:typeface="monospace" >

            <requestFocus />
        </com.empite.telegramstop.Txt>
    </FrameLayout>

    <TextView
        android:id="@+id/remain"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignRight="@+id/c"
        android:layout_centerVertical="false"
        android:layout_marginRight="-15dp"
        android:layout_marginTop="325dp"
        android:gravity="center"
        android:text="@string/remaining"
        android:textColor="@color/remain"
        android:textSize="40dp"
        android:textStyle="bold"
        android:visibility="visible" />

    <ImageView
        android:id="@+id/nxt"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/remain"
        android:layout_below="@+id/c"
        android:layout_marginLeft="20dp"
        android:layout_marginTop="148dp"
        android:contentDescription="@string/image"
        android:scaleType="center"
        android:src="@drawable/bt_next" />

    <RelativeLayout
        android:id="@+id/RelativeLayout2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/own"
        android:layout_below="@+id/txtlayer"
        android:layout_marginTop="290dp"
        android:background="@drawable/panel_type_code" >

        <EditText
            android:id="@+id/no1"
            android:layout_width="55dp"
            android:layout_height="75dp"
            android:layout_alignParentLeft="true"
            android:layout_marginLeft="275dp"
            android:layout_marginTop="18dp"
            android:background="@null"
            android:gravity="center"
            android:imeOptions="actionDone"
            android:inputType="number"
            android:maxLines="1"
            android:textSize="45dp"
            android:textStyle="bold"
            android:typeface="serif" />

        <EditText
            android:id="@+id/no2"
            android:layout_width="55dp"
            android:layout_height="75dp"
            android:layout_alignBaseline="@+id/no1"
            android:layout_alignBottom="@+id/no1"
            android:layout_marginLeft="10dp"
            android:layout_toRightOf="@+id/no1"
            android:background="@null"
            android:ems="10"
            android:gravity="center"
            android:imeOptions="actionDone"
            android:inputType="number"
            android:textSize="45dp"
            android:textStyle="bold"
            android:typeface="serif" />

        <EditText
            android:id="@+id/no3"
            android:layout_width="55dp"
            android:layout_height="75dp"
            android:layout_alignBaseline="@+id/no2"
            android:layout_alignBottom="@+id/no2"
            android:layout_marginLeft="10dp"
            android:layout_toRightOf="@+id/no2"
            android:background="@null"
            android:ems="10"
            android:gravity="center"
            android:imeOptions="actionDone"
            android:inputType="number"
            android:textSize="45dp"
            android:textStyle="bold"
            android:typeface="serif" />

        <EditText
            android:id="@+id/no4"
            android:layout_width="55dp"
            android:layout_height="75dp"
            android:layout_alignBaseline="@+id/no3"
            android:layout_alignBottom="@+id/no3"
            android:layout_marginLeft="9dp"
            android:layout_toRightOf="@+id/no3"
            android:background="@null"
            android:ems="10"
            android:gravity="center"
            android:imeOptions="actionDone"
            android:inputType="number"
            android:textSize="45dp"
            android:textStyle="bold"
            android:typeface="serif" />

        <EditText
            android:id="@+id/no5"
            android:layout_width="55dp"
            android:layout_height="75dp"
            android:layout_alignBaseline="@+id/no4"
            android:layout_alignBottom="@+id/no4"
            android:layout_marginLeft="9dp"
            android:layout_toRightOf="@+id/no4"
            android:background="@null"
            android:ems="10"
            android:gravity="center"
            android:imeOptions="actionDone"
            android:inputType="number"
            android:textSize="45dp"
            android:textStyle="bold"
            android:typeface="serif" />

        <EditText
            android:id="@+id/no6"
            android:layout_width="55dp"
            android:layout_height="75dp"
            android:layout_alignBaseline="@+id/no5"
            android:layout_alignBottom="@+id/no5"
            android:layout_marginLeft="10dp"
            android:layout_toRightOf="@+id/no5"
            android:background="@null"
            android:ems="10"
            android:gravity="center"
            android:imeOptions="actionDone"
            android:inputType="number"
            android:textSize="45dp"
            android:textStyle="bold"
            android:typeface="serif" />
    </RelativeLayout>

    <EditText
        android:id="@+id/editText1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@null"
        android:ems="10"
        android:visibility="visible" />
</RelativeLayout>
like image 777
Chrishan Avatar asked Nov 04 '22 13:11

Chrishan


1 Answers

try this may be it is use full adjust manifest

 <activity
     android:windowSoftInputMode="adjustResize"              
     android:name=".youractivity" android:label="@string/app_name" >

and see this move up text view only when virtual keyboard open on android

like image 71
NagarjunaReddy Avatar answered Nov 15 '22 00:11

NagarjunaReddy