I am making an android app where the user fills up a form. The client wants that out of many of the fields of the form, The user should see the compulsory fields first and then if the user wants then he/she should click on a button named as "More Fields (Optional)" and as soon as he clicks the button the button should disappear and then the user should see the other fields laid out one after the other.
The form looks like this now
I have already tried setting the visibility of the edit Text to invisible, but the problem is that even if the text fields are invisible they take up most part of the screen.
I have been scrolling through the android forums but i got no hint as to how i can achieve it.
It worked, I set the visibility to Gone and then everything happened as it was supposed to be.
Related
Problem: In soft keyboard settings, there is a toolbar option, if we turn it on, it will give you some suggestions, for example, if a copied something, it will start appearing on the top of keyboard(marked red in the screen shot), if the user clicks that suggestion, it will be pasted on the edit text which have the focus.
Things i have tried.
override autofill method (not working, not called).
added text watcher, beforeTextChanged is called and the editable text is empty.
added the OnKeyListener (not working, not called).
added the onTextContextMenuItem (not working, not called).
Read bunch of questions on Stackoverflow but no question/answer is helping.
here is the screen shot:
PS: I am not sure how can i capture this click, and intercept the text, problem is that I am using the custom view for OTP, and when user click that suggestion, only first box is filled with the first character because we have max length equals to 1. I want to capture that text and fill it in my view accordingly. Any help is appreciated.
I have checked the following documents
https://developer.android.com/guide/topics/text/autofill
https://developer.android.com/guide/topics/text/copy-paste
I have a bar in my app with 2 buttons side by side. One button represents the page the user is currently on and the other redirects the user to another page with the same button bar. What I want is for the button that represents the page the user is currently on to look like it is pressed (i.e. the color it would be if it is pressed). I already have it set so it can't be clicked. Is there a setting or attribute or do I HAVE to create my own selector (because I don't really understand how to implement that)?
Have never tried this but
button.setPressed(true)
should work.
Edit: You can also add
button.setClickable(false)
Edit: This does work but the order is important. Use this
btn.setClickable(false);
btn.setPressed(true);
What I want
A simple EditText. User should be able to enter text at any point of time.
onClick of this EditText, a popup should appear anchored to the EditText.
onClick of this EditText, if popup is already being shown, then dismiss the popup.
This popup will contain a list of items (that i decide and no filtering) on clicking of which the EditText will be filled with the clicked item.
When I start typing, the popup should go away.
I should be able to set the animation of the drop down list.
What were my options
Obviously, AutoCompleteTextView. Worked great after customizing AutoCompleteTextView. But there were two problems?
I was able to accomplish points 1, 2, 4 and 5. How do I get around this number 3 and number 5?
Since nothing worked...
I thought I can just put a edit text and show a popup window. :)
But that fails utterly...
I just tried to do the simple way. I added a EditText. And then I created a class of PopupWindow and inflated a listview in it. Then I anchored it to my EditText. Now the problem starts again -
I click on the EditText. The popup appears. Takes all the focus and the keyboard goes away. Definitely not what I want. So i made the popup window not focusable.
And now I click on the EditText, the popup appears. Doesn't take the focus. So keyboard stays to take input. Just perfect like I want. But when I click a list item in the ListView, it doesn't do anything. Why? It is not focusable!
So what do i do now? Which way do I go?
For 3. you can create an onFocusChange listener, or and onClickListener and explicitly call _autoCompleteView.dismissDropDown();. You can use isPopupShowing() to see if it is already showing and manually dismiss it in that case.
For 5. you just do the same thing but you do _autoCompleteView.registerDataSetObserver and put that logic in the onChanged() event or possibly in the addTextChangedListeneron your autoCompleteTextView.
I am not entirely sure if this is the functionality you were looking for but this thread is almost a year old now so maybe it will be helpful for someone in the future.
When my app is first run, I would like to have a welcome message displayed in a dialog box. Then the user can click next at the bottom, and the box stays but a new layout is displayed where the user can input information.
How would I go about this? It would also be great if I was able to add an animation between the two layouts, the second one sliding in from the right for example. Is this possible?
I was thinking I may be able to use
builder.setView(secondlayout);
I'm having a problem with my login form, it consists of username, password, and submit button. But when I touch my username EditText, the keyboard shows and it covers up my password and submit button.
Then I change my manifest to
android:windowSoftInputMode="adjustResize|stateHidden"
The whole form is now goes up, but my layout becomes resized and it doesn't look good. So, can I control how much my layout will go up, when I use adjustPan?
Try setting
android:layout_weight="1" for the all the
texts and buttons used..It may work.