EditText in popup window: keyboard isn't shown - android

I've created a layout for a survey as a popup window, but somehow keyboard isn't shown when a focus is true, even after a tap to the edittext...
In other activities, all EditTexts work correctly.
Recently, I've changed app Theme to AppCompat to implement Material components. I am not sure it can impact, but no ideas from my side, why it doesn't work.
Any ideas?
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#66ccff"
android:gravity="center" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/imageSurveyClose"
android:layout_centerHorizontal="true"
android:paddingTop="40dp"
android:fontFamily="sans-serif"
android:gravity="center"
android:text="Question"
android:textColor="#ffffff"
android:textSize="22dp" />
<ImageButton
android:id="#+id/imageSurveyClose"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:src="#drawable/close"
android:background="#null" />
<Button
android:id="#+id/button1"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:text="Send" />
<RadioGroup
android:id="#+id/radioGroup2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/textView1"
android:paddingTop="20dp"
android:layout_marginLeft="20dp"
>
<RadioButton
android:id="#+id/radio0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:text="v1"
android:layout_gravity="left"
android:fontFamily="sans-serif"
android:textSize="22dp"
android:buttonTint="#ffffff"
android:textColor="#ffffff"
android:layout_marginTop="10dp"
/>
<RadioButton
android:id="#+id/radio1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:fontFamily="sans-serif"
android:text="v2"
android:buttonTint="#ffffff"
android:layout_marginTop="12dp"
android:textColor="#ffffff"
android:textSize="22dp" />
<RadioButton
android:id="#+id/radio2"
android:layout_width="wrap_content"
android:buttonTint="#ffffff"
android:layout_height="wrap_content"
android:text="v3"
android:layout_gravity="left"
android:fontFamily="sans-serif"
android:layout_marginTop="12dp"
android:textSize="22dp"
android:textColor="#ffffff"
/>
</RadioGroup>
<EditText
android:id="#+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/radioGroup2"
android:layout_below="#+id/radioGroup2"
android:layout_marginTop="47dp"
android:ems="10" >
<requestFocus />
</EditText>
</RelativeLayout>

You can try removing the <requestFocus /> element in the EditText and see whether the keyboard appears. Afterwards you can request the focus programmatically inside the activity.

Related

Progress bar is not center when under relative layout

I am using relative layout in my android app.
Following is my main.xml.
<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:gravity="fill"
tools:context="com.example.asdf.MainActivity" >
<WebView
android:id="#+id/webView1"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<ImageView
android:id="#+id/imageView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:scaleType="fitXY"
android:src="#drawable/bgg" />
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="22dp"
android:layout_marginTop="22dp"
android:gravity="center"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
android:text=" Factualnote is an web annotation application, which helps the users to mark the specific text, element, page, video, etc in a web page and share it to like-minded people.\r\n \r\nAs we know the relevant data has been wide-spreaded across various sites under many intentions, factualnote is a type of social software tool in which factual data are brought forward or narrow down to the web users."
android:textColor="#ffffff"
android:textSize="25sp"
android:textStyle="normal|italic" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:orientation="vertical" >
<EditText
android:id="#+id/url"
android:layout_width="290dp"
android:layout_height="33dip"
android:layout_above="#+id/button_show"
android:layout_centerHorizontal="true"
android:layout_gravity="center_horizontal"
android:background="#ffffff"
android:ems="17"
android:hint="#string/edit_hint"
android:radius="10dp"
android:singleLine="true"
android:text="http://www.zeptoh.com/lynked/sel.html"
android:textColor="#000000"
android:textSize="16sp" >
<requestFocus />
</EditText>
<Button
android:id="#+id/button_show"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:background="#drawable/blue_button"
android:text="#string/button_title"
android:textColor="#ffffff" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<Button
android:id="#+id/undo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_weight="9"
android:background="#drawable/blue_button2"
android:text="#string/undo"
android:textColor="#ffffff" />
<Button
android:id="#+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_weight="9"
android:background="#drawable/blue_button2"
android:text="Mark"
android:textColor="#ffffff" />
<Button
android:id="#+id/done"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_weight="10"
android:background="#drawable/blue_button2"
android:text="Generate"
android:textColor="#ffffff" />
<Button
android:id="#+id/redo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_weight="9"
android:background="#drawable/blue_button2"
android:text="#string/redo"
android:textColor="#ffffff" />
</LinearLayout>
</LinearLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:id="#+id/rl2"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true" >
<EditText
android:id="#+id/name"
android:layout_width="250dp"
android:layout_height="33dip"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:background="#ffffff"
android:ems="17"
android:layout_gravity="center_horizontal"
android:hint="Enter Title"
android:singleLine="true"
android:textColor="#000000"
android:textSize="16sp" />
<EditText
android:id="#+id/desc"
android:layout_width="250dp"
android:layout_height="33dip"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="50dp"
android:background="#ffffff"
android:ems="17"
android:layout_gravity="center_horizontal"
android:hint="Description about your note"
android:singleLine="true"
android:textColor="#000000"
android:textSize="16sp" />
<TextView
android:id="#+id/privateText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/desc"
android:layout_below="#+id/desc"
android:layout_marginTop="10dp"
android:text="Private Note:"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#ffffff"
android:textSize="20sp"
android:checked="true"
android:buttonTint="#color/desing_color"
android:textStyle="bold" />
<RadioGroup
android:id="#+id/radioSex"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignTop="#+id/privateText"
android:layout_toRightOf="#+id/privateText"
android:orientation="horizontal" >
<RadioButton
android:id="#+id/yes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="1dp"
android:text="Yes"
android:buttonTint="#color/desing_color"
android:textColor="#ffffff"
android:textSize="15sp"
android:textStyle="bold" />
<RadioButton
android:id="#+id/no"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/privateText"
android:layout_marginLeft="14dp"
android:layout_toRightOf="#+id/yes"
android:text="No"
android:textColor="#ffffff"
android:textSize="15sp"
android:checked="true"
android:buttonTint="#color/desing_color"
android:textStyle="bold" />
</RadioGroup>
<Button
android:id="#+id/generate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:background="#drawable/blue_button"
android:layout_below="#+id/radioSex"
android:layout_marginTop="10dp"
android:layout_marginLeft="70dp"
android:textColor="#ffffff"
android:text="Generate Note" />
<Button
android:id="#+id/back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_below="#+id/radioSex"
android:background="#drawable/blue_button"
android:layout_marginTop="10dp"
android:layout_marginLeft="200dp"
android:textColor="#ffffff"
android:text="Back" />
</RelativeLayout>
<ProgressBar
android:id="#+id/progressBar1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true" />
</RelativeLayout>
I put progress bar to center in horizontal and vertical. But that is placed on top of the screen only.
When I remove Linear layout rl2, progress bar appears center.
What I need to do to get progress bar in center even I have rl2.
Try adding
android:layout_centerInParenta="true"
to the progressbar and tell me if it works.
Did you try to remove android:gravity="fill" from the main container? (the first relative layout, the one that contains all the layout)
add the following line in your xml file,
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/progressBar"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true" />
if its not work, then first add progressbar and then add your views. Maybe it will work.

Android soft input keypad pushes buttons up which overlap other views

I have a button aligned to the bottom of my Relative Layout which I want to be pushed up when soft keypad is shown, but I don't want it to overlap other views, any hints?
I have the following layout(XML):
<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:background="#drawable/bg_app" >
<Spinner
android:id="#+id/spinner1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/Button01"
android:layout_centerHorizontal="true"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="02dp"
android:background="#drawable/options_bg" />
<ImageView
android:id="#+id/imageView1"
android:layout_width="120dp"
android:layout_height="120dp"
android:layout_alignLeft="#+id/spinner1"
android:layout_below="#+id/textView6"
android:layout_marginTop="03dp"
android:scaleType="centerCrop" />
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/imageView1"
android:layout_below="#+id/spinner1"
android:layout_marginLeft="03dp"
android:layout_toRightOf="#+id/imageView1"
android:text="Date"
android:textColor="#002f44"
android:textSize="18sp" />
<Button
android:id="#+id/button2"
android:layout_width="170dp"
android:layout_height="30dp"
android:layout_alignLeft="#+id/textView1"
android:layout_alignRight="#+id/spinner1"
android:layout_below="#+id/textView1"
android:layout_marginTop="05dp"
android:background="#drawable/btn_calendar"
android:textColor="#FFBF00" />
<AutoCompleteTextView
android:id="#+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/imageView1"
android:layout_alignLeft="#+id/button2"
android:layout_alignRight="#+id/spinner1"
android:digits="abcdefghijklmnopwrstuvwxyzABCDEFGHIJKLMNOPWRSTUVWXYZ. "
android:ems="6"
android:hint="Enter Name"
android:inputType="textCapWords"
android:maxLength="25"
android:textColor="#002f44" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/editText1"
android:layout_below="#+id/editText1"
android:padding="03dp"
android:textColor="#610B0B" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:visibility="invisible" />
<Button
android:id="#+id/button1"
android:layout_width="120dp"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:background="#drawable/btn_addreminder"
android:text="Save"
android:textColor="#002f44"
android:textStyle="bold"
android:visibility="gone" />
<RadioGroup
android:id="#+id/radioGroup1"
android:layout_width="180dp"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_marginTop="-5dp"
android:background="#drawable/widget_style"
android:orientation="horizontal"
android:visibility="gone" >
<RadioButton
android:id="#+id/radio0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:text="Self"
android:textColor="#002f44" />
<RadioButton
android:id="#+id/radio1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="25dp"
android:text="Other"
android:textColor="#002f44" />
</RadioGroup>
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/button1"
android:layout_alignBottom="#+id/button1"
android:layout_alignRight="#+id/Button01"
android:text="Type "
android:textColor="#002f44"
android:textSize="18sp"
android:visibility="gone" />
<TextView
android:id="#+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView4"
android:layout_below="#+id/radioGroup1"
android:layout_marginTop="25dp"
android:text="Name"
android:textColor="#002f44"
android:textSize="18sp"
android:visibility="gone" />
<AutoCompleteTextView
android:id="#+id/autoname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:digits="abcdefghijklmnopwrstuvwxyzABCDEFGHIJKLMNOPWRSTUVWXYZ. "
android:ellipsize="end"
android:ems="8"
android:hint="Friends Name"
android:maxLines="1"
android:scrollHorizontally="true"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#002f44"
android:visibility="gone" >
</AutoCompleteTextView>
<TextView
android:id="#+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/spinner1"
android:layout_alignRight="#+id/spinner1"
android:layout_below="#+id/spinner1"
android:clickable="false"
android:lineSpacingExtra="2.3dp"
android:padding="10dp"
android:text="TextView"
android:textColor="#002f44"
android:textSize="14sp"
android:visibility="invisible" />
<Button
android:id="#+id/Button01"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginRight="10dp"
android:layout_marginTop="05dp"
android:background="#drawable/btn_exit"
android:textStyle="bold" />
<Spinner
android:id="#+id/spinner2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/imageView1"
android:layout_alignRight="#+id/editText1"
android:layout_below="#+id/textView2"
android:layout_marginTop="03dp"
android:background="#drawable/drop_down" />
<Button
android:id="#+id/Button02"
android:layout_width="100dp"
android:layout_height="40dp"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_marginBottom="0dp"
android:layout_marginRight="20dp"
android:background="#drawable/btn_addreminder"
android:text="Next"
android:textColor="#002f44"
android:textStyle="bold" />
<Button
android:id="#+id/button4"
android:layout_width="100dp"
android:layout_height="40dp"
android:layout_alignBaseline="#+id/Button02"
android:layout_alignBottom="#+id/Button02"
android:layout_alignParentLeft="true"
android:layout_marginLeft="42dp"
android:background="#drawable/btn_addreminder"
android:text="Skip"
android:textColor="#002f44"
android:textStyle="bold" />
</RelativeLayout>
In the manifest:
android:windowSoftInputMode="stateHidden|adjustResize"
below is the picture:
The problem is that you use alignParentBottom=true for your button. Try to construct the layout without setting this parameter to true.
<Button
android:id="#+id/Button02"
android:layout_width="100dp"
android:layout_height="40dp"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_marginBottom="0dp"
android:layout_marginRight="20dp"
android:background="#drawable/btn_addreminder"
android:text="Next"
android:textColor="#002f44"
android:textStyle="bold" />
EDIT
As the documentation says:
adjustResize The activity's main window is always resized to make room for the soft keyboard on screen.
adjustPan The activity's main window is not resized to make room for the soft keyboard. Rather, the contents of the window are automatically panned so that the current focus is never obscured by the keyboard and users can always see what they are typing. This is generally less desirable than resizing, because the user may need to close the soft keyboard to get at and interact with obscured parts of the window.
I suggest you to rethink the design, and use adjustPan instead of adjustResize.
But if your next button is meant to be used to navigate through your edit texts than take a look at this
try to use this android:windowSoftInputMode="stateUnchanged|adjustResize"

Switch between two or more edit text in android

Suppose I have two or more EditTextview in my layout and at run time by mistake I selected 2nd view and filled it with text; now I want to go to previous EditText view and on touch gain it's focus to write some text inside it.
But I am unable to do this. I can't gain focus of view and write it on click that particular view.
See the code below:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#drawable/wall">
<EditText
android:id="#+id/title"
android:layout_width="fill_parent"
android:layout_height="40dp"
android:textSize="30dp"
android:focusable="true"
android:hint="#string/Title" />
<EditText
android:id="#+id/body"
android:layout_width="fill_parent"
android:layout_height="350dp"
android:textSize="25dp"
android:paddingTop="45dp"
android:gravity="top"
android:inputType="textMultiLine|textNoSuggestions"
android:ems="10"
android:focusable="true"
android:hint="#string/program" />
<TextView
android:id="#+id/CalDisplay"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:textSize="20dp"
android:layout_below="#+id/save" />
<Button
android:id="#+id/Calculate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="#+id/body"
android:layout_toRightOf="#+id/RunProgram"
android:background="#drawable/custom_button"
android:textColor="#ffffff"
android:text="#string/Calculate" />
<Button
android:id="#+id/save"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/Calculate"
android:layout_alignBottom="#+id/Calculate"
android:layout_alignParentLeft="true"
android:layout_toLeftOf="#+id/RunProgram"
android:background="#drawable/custom_button"
android:textColor="#ffffff"
android:text="#string/Save"
/>
<Button
android:id="#+id/RunProgram"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/body"
android:layout_centerHorizontal="true"
android:background="#drawable/custom_button"
android:textColor="#ffffff"
android:text="#string/Run" />
</RelativeLayout>
Try this...
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<EditText
android:id="#+id/title"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:hint="Title"
android:textSize="15dp" />
<EditText
android:id="#+id/body"
android:layout_width="fill_parent"
android:layout_height="350dp"
android:layout_below="#+id/title"
android:layout_marginTop="5dp"
android:gravity="left"
android:hint="program"
android:inputType="textMultiLine|textNoSuggestions"
android:textSize="15dp" />
<TextView
android:id="#+id/CalDisplay"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_below="#+id/save"
android:textSize="20dp" />
<LinearLayout
android:id="#+id/linearButtons"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/body" >
<Button
android:id="#+id/Calculate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Calculate"
android:textColor="#ffffff" />
<Button
android:id="#+id/save"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Save"
android:textColor="#ffffff" />
<Button
android:id="#+id/RunProgram"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Run"
android:textColor="#ffffff" />
</LinearLayout>
</RelativeLayout>
Replace RelativeLayout with LinearLayout. Because it seems like your EditText are overlapping each other (causing the problem in getting focus), or at least add some respective aligning to them.
For example, add the following to your second EditText:
android:layout_below="#id/title"

android softkeyboard pushes layout up

So basically i have a main layout which is a log in screen. The problem is that whole Relative-layout goes off the screen when i tap onto Edittext field...
Here is my xml:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#drawable/background_gradient"
android:theme="#android:style/Theme.NoTitleBar"
tools:context=".MainActivity" >
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/editText1"
android:layout_centerHorizontal="true"
android:layout_marginBottom="60dp"
android:baselineAlignBottom="true"
android:contentDescription="#string/skedo"
android:src="#drawable/logo" />
<EditText
android:id="#+id/editText1"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:layout_above="#+id/editText2"
android:layout_centerHorizontal="true"
android:layout_marginLeft="13dp"
android:layout_marginRight="13dp"
android:drawableLeft="#drawable/user"
android:drawablePadding="13dp"
android:paddingLeft="13dp"
android:inputType="textEmailAddress"
android:background="#drawable/round_corners"
android:ems="10"
android:hint="#string/email" />
<EditText
android:id="#+id/editText2"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:layout_centerInParent="true"
android:layout_marginLeft="13dp"
android:layout_marginRight="13dp"
android:layout_marginTop="8dp"
android:drawableLeft="#drawable/lock"
android:drawablePadding="13dp"
android:paddingLeft="13dp"
android:background="#drawable/round_corners"
android:ems="10"
android:hint="#string/password"
android:inputType="textPassword" >
</EditText>
<Button
android:id="#+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/editText2"
android:layout_centerHorizontal="true"
android:layout_marginTop="8dp"
android:textSize="17sp"
android:shadowColor="#000000"
android:shadowRadius="1"
android:shadowDx="0"
android:shadowDy="1"
android:text="#string/login"
android:textColor="#ffffff"
android:background="#drawable/button_states" />
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/button1"
android:layout_centerInParent="true"
android:layout_marginTop="23dp"
android:clickable="true"
android:text="#string/forgot_password"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="13sp" />
<ImageView
android:id="#+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/textView1"
android:layout_centerHorizontal="true"
android:layout_marginTop="23dp"
android:contentDescription="#string/imgdesc"
android:src="#drawable/or" />
<Button
android:id="#+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/imageView2"
android:shadowColor="#ffffff"
android:shadowRadius="1"
android:shadowDx="0"
android:textSize="14sp"
android:textStyle="bold"
android:shadowDy="1"
android:layout_centerHorizontal="true"
android:layout_marginTop="23dp"
android:text="#string/register"
android:background="#drawable/create_account"
/>
So when this happens my logo disappears off the screen and i would like it to be showing. The best example would be facebook log in screen, where when you tap on editText it squashes everything and logo is still visible. So how can i achieve such effect?
So when nothing is pressed:
http://postimage.org/image/swdtggnil/
When keyboard appears
http://postimage.org/image/5pbdfrftl/
I want it to behave exactly like that.
If I have not misunderstood you can add
android:windowSoftInputMode="adjustPan"
in the AndroidManifest.xml
<activity
android:name="yourActivity"
android:windowSoftInputMode="adjustPan" >
</activity>

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.
I want it to look like this.
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>
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
use the EditText's setOnFocusChangeListener() method, and change the layout accordingly.
Try to add a ScrollView before your root RelativeLayout, and delete the android:windowSoftInputMode from your manifest.

Categories

Resources