Android animate edittext up on click - android

I have put ten edit text in scroll view when i click on edit text my keyboard appear. What i want when i click on edit text one its automatically show the edit text two which is right below the edit text one. I have used
android:windowSoftInputMode="adjustPan"
but none of them giving me the desired result and i think by doing this way i cannot acheive this.
Right Now I have to scroll manually or click on the next button. How to achieve this automatically as i have seen this functionality in many of the apps?

In your manifest, within the "activity" declaration for the Activity you need to resize, add
android:windowSoftInputMode="adjustResize"
If it doesn't work with your ScrollView you may need to implement a simple ListView.

Related

Edit text weird behavior

I have an ExpandableListView which contains a RecyclerView of a custom layout. This layout contains some views including my EditText.
My behavior is : When I click in my number EditText, the keyboard appears for about 0.5s, the whole layout is cleared with default values, then the keyboard disappears, a text EditText appears, and finally I loose focus. When I click on it one more time, the keyboard stays, but in text type. Strange thing : the problem seems to be only on devices where the whole layout overflows the screen because on 10" tablet, everything is ok (layout not cleared, and keyboard not disappearing).
According to me, when I get the focus in the EditText, the layout is re-creates , making it to be cleared.
I tried a long time to figure out what was going on, but I didn't find anything. Here is the things I tried, but didn't change anything :
android:descendantFocusability="beforeDescendants" // on all parent of the EditText
focusable="true" // On the EditText
android:windowSoftInputMode="adjustPan" // In the activity in the manifest
making all the ViewHolder attributes final
As the code is very huge for all that amount of things, I don't know what I should post to help. So don't hesitate to ask anything if it can help
Thanks!
EDIT : A Gif showing the issue https://imgur.com/a/BPue4
Try adding this line to your activity on manifest.xml:
android:configChanges="keyboardHidden|screenSize"
Opening keyboard or screen size changes may trigger to re-create your content.

Android moving edit text automitcally

I have three EditText views named edittext_one ,edittext_two and edittext_three. I have put these views in a ScrollView. These EditTexts are clearly visible on the screen until my keyboard is not open. Now, I click on edittext_one, which is at the top, and my keyboard appears. Then, it hides my edittext_two and edittext_three. I want to go edittext_two just little bit up when I am typing in edittext_one so that user can see edittext_two. Same is happen with edittext_three. When user click on edittext_two, edittext_three slightly move up so user can see it.
I have lots of EditText in a scrollView, but I have just explained here three.
Please don't suggest me to use adjust pan and adjust resize because it never solves my problem.
Here is the link I used for iPhone
Sliding UITextFields around to avoid the keyboard but how do I do this in Android?
Try adding a click listener on edittext_one that does this:
int top = edittext_two.getTop();
scrollView.scrollTo(0,top);

Android ExpandableList Header with spinner

I'm developing an application and I am facing a problem using ExpandableListView. What I'm trying to do is, in GroupHeader, not only show the group name, but also an spinner with options. That's because I want to show the football second division games in the list but, also, give the option to choose the round, in case the user wants to check older/future games. SO far I have that
As you can see both, title and spinner, shows. Also you can see the arrow on the right which is supposed to expand the list. Problem is that, if I click, only spinner opens, group expand button doesn't. So, here is my question, how can I make both of them work depending on where you click (one or another)??? Is that possible?
Also I must say that if I only place the TextView with the group name works perfect. If I only place the spinner, the problem persists. So I'm guessing that's a focus problem.
Btw: grey areas are the layout backgrounds, so no, they are not hiding behind the button.
I found the solution, I just neede to add this line android:descendantFocusability="blocksDescendants" to the Main Layout of the xml where I define the GroupHeader elements.

How to prevent the soft keyboard from displaying, or at least evict it once it does?

My app has an EditText that, when I click in it to enter text in the Emulator, brings up a soft keyboard. I don't want this confounded thing to begin with, but then, like the visiting loud-mouthed uncle in the plaid pants, doesn't want to go away, and it is blocking the button beneath it. How do I either (a) prorgrammatically prevent the soft keyboard from appearing or at least (b) evict it, albeit manually, when it pops up?
Provided that the user is not supposed to input text, but is able to click the EditText and then add text in some other way, you could change the EditText to a TextView and then apply the following three tags to it in the layout file:
style="#android:style/Widget.EditText"
android:editable="false"
android:focusableInTouchMode="false"
This will make it look like an EditText, but behave like a TextView.
Since you want the user to be able to write stuff in the EditText there are in my opinion two solutions:
Leave it be. To remove the keyboard, all you need is to hit the back button once and every Android user knows this. It's standard behaviour.
Wrap everything but the Button you say dissapears in a ScrollView. The ScrollView will then wrap its content to allow the Button to be shown in between the keyboard and the ScrollView.
Just set android:editable="false" for your EditText
The answer is to set the focus on an other View like a Button, TextView or similar:
// REQUEST FOCUS
viewName.setFocusableInTouchMode(true);
viewName.requestFocus();
I think what you really need is take a look at android:windowSoftInputMode attribute in Manifest.xml Look into this link.
You can specify the screen to pan/ resize to show the buttons that the input method might be blocking. Not allowing the keyboard to show will make the user unable to enter text at all!

Relative Layout Android

I have a layout of a user entry form.when i enter username and password and hit the submit button.the content should be saved and another div with three textboxes and editboxes should appear in the same page.
Replacing the content might not be the best solution.
Anyway, you can create all these elements together in the same layout and set the "div with three textboxes and editboxes" initially to "hidden".
After you have clicked the button and triggered the desired event, you grab the desired elements and make them visible while setting the unwanted elements to hidden again.
Charles Merriams answer would be the more elegant and cleaner way, this only answers the "base" question.
The magic word you need to look at is "Intent". You call your own application in order to switch layouts after the submit button.
You may find the Notepad tutorial useful.
You can try what DrColossos said or you can try by just setting a different contentview on button click.

Categories

Resources