I am customizing the android keyboard after downloading the sample keyboard code from developer.android.com. I want to customize the layout of the popup window after a user made a long press on a given key, onLongPress(key popupKey). Particularly, I want to get ridoff the close button at the end of the popup keys and want to make the window close when the user clicks outside it. But, I can't figure out how to get access to the popup window. Please give me some hints.
I finally figure it out myself and want to share for anyone interested.
I was not able to get the close button and get rid off it. But, what I got easier is creating a PopupWindow having multiple buttons whose labels are the popup characters taken from the key parameter passed to onLongPress().
This way I was able to display only the popup characters and close the window when the user selects on of them or presses outside of the window.
Cheers!
Related
I m making book finder app.
step1: i clicked on search button and activity is waiting for my book title
step2: i input some book title
step3: the focus still stays on this search button, i have to click on screen to make it go away.
is there way to automatically loose focus on last widget i clicked on?
You probably just want to call requestFocus() on your book list whenever a search completes (however, if there are no results, you may want to re-open your search box, or do so after a delay). There is also a OnFocusChangedListener which might be of help if requesting focus on your list after serving up results does't work for some reason.
Is there a way to find out when did a user click "Setting" options on the screen menu?
The onClick listner's KeyDown events catches only the hardware buttons on the phone and not the clicks of the sofware keyboard that shows up when a textbox/editText gets a focus and the key guard shows up.
Is it even possible using public android SDK.
P.S. : I am only concerned with 2.2 and 2.3 so its fine if this is not possible on 3.0 and above.
Thnx
EDIT
Explanation of a scenario that will help understand the question better!
I have a full screen activity with a editText and a button. I want to intercept all the clicks that a user make and based on that make some decisions.
I am able to register a listner to intercept what phisical keys are being clicked(HOME, MENU, VOLUME UP/DOWN etc)...The problem is, when the user clicks on the editText i.e. the text box gets the focus, the sotware keypad shows up. Now I also want to intercept what keys(numbers, alphabets, special characters or even custom functions on some samsung android phone like 'Go To Settings' are clicked and perform action based on the clicks.
My question is, is it possible and if yes, then how?
NOTE: Please dont ask me why am I doing this because its bad user experience. I am very much aware of that. I am trying to do this in a particular context that needs this functionality. Thnx!
You need to use the KeyListener class and setKeyListener
http://developer.android.com/reference/android/widget/TextView.html
This only allows you to modify/filter input into the TextView.
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’ve created a search activity in my app, in the standard Android way, without custom suggestions. When a user starts typing text or presses the search button, they get a search dialog with search box, something like figure 1 from here:
http://developer.android.com/guide/topics/search/search-dialog.html
You’ll notice in the background is the previous activity, the words “abide”, etc.
My problem is that the previous activity is shown clear as day behind the search dialog, and its confusing for users, because users think all that is still active, and they try to press on it, but it just cancels the search dialog. And it distracts the user from the search task (are those search results, they may wonder?).
Question: how to blur (make out of focus) or darken the previous activity?
I actually see this in some app’s search screens.
I found a simple way to blur the background of the search dialog:
Basically it's just adding a (half) transparent view over the ListView (or what is under the dialog) and hide it by default. If the search dialog appears (calling onSearchRequested()) it is set to visible, if it disappears it's set back to gone (invisible).
Check out the details at my blog: http://mavistechchannel.wordpress.com/2011/08/13/blur-background-android-search-dialog/
Assuming you got dialog from a Dialog.Builder, use the following:
dialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
i have a list.When i click on any item in the list a popup should appear where i can send messages(something like what happens when we click a user in gmail.A popup window comes up in the bottom and we can chat with that user).
I guess you want to add a Quick Action to your application.
You should be able to get your answer from this question.