create a android soft keyboard with other views attached to it - android

I want to develop a custom keyboard where I can add other views above it. how can I achieve this? what will be the main container layout?
I basically want to add banner ads on top of the keyboard. you can provide be a general example to put any view with keyboard view.
like this keyboard

Keyboards must implement an InputMethodService. One of the functions on it is onCreateInputView. That returns the View to display. This can be any View you want, including q layout with ads.
That said- nobody will ever use a keyboard with ads on it. I really don't suggest it.

Related

Custom Android keyboard without KeyboardView

I have seen lots of answers on SO and tutorials on internet on custom keyboard development. However, all of them use KeyboardView for displaying keyboard. It is difficult to manage KeyboardView and KeyboardView does not show custom layouts. Is there any other way to implement custom keyboard app that shows custom layouts?
In your InputMethodService, there's a function onCreateInputView. It returns the main view of your keyboard. You can have it return any view you want, including a custom one. In fact I don't think any serious keyboards actually use KeyboardView- it's too limiting.

How to get keyboard with Next, Previous and Done buttons at the top of keyboard in Android

In my application, I want to provide the functionality similar to Next, Previous and Done button at the top of keyboard. It is somewhat similar to this
Please let me know how can I achieve this.
I do not want to exactly implement the next,previous and done options. But using this three button click, I want to make three separate web service calls and fetch the results. Like, Active,Inactive and All kind of filters.
The standard Android way would be to provide an input method action with imeOptions. With the standard keyboard this will change the bottom right virtual keyboard button to the specified action. There's little point in trying to mimic iOS input behavior with the buttons above.
Do you want to just put the layout above the keyboard,so as to stop next,previous,etc button when keyboard is displayed.
If so,you can try adding below code inside your activity in android manifest,
android:windowSoftInputMode="adjustResize"
If you are looking for something else,then please show your xml code of the same.

Showing the keyboard without animation

I have a problem with the animation of the soft-keyboard since ICS. I got an activity for data entry using the soft-keyboard. The window is set to "adjustResize" in order to fit all Views into the screen above the soft-keyboard.
Since Android 4 the fancy animation of opening the keyboard, let's the views on my screen "bounce".
It seems, as if the view is layouted, then the keyboard opens and after this the screen is relayouted, leading to kind of a jumpy UX.
There was a similar question:
( How to show/hide the soft keyboard without any animation (e.g. fade) in Java? )
However, the solution over there does not work for me. (tested on 4.2.1)
I would be glad, if anyone has some clues on achieving one of the following solutions:
Disable the animation of the soft-keyboard for an activity
Retrieve the size of the soft-keyboard in order to set the size of the screen manually
Cheers,
Florian
You can't get the height of soft-keyboard. I don't think there is a need to do so, you can achieve the same use-case by trying different approach.
If you don't want to re-layout screen, you can use android:windowSoftInputMode attribute in-order to have some more control over the screen rendering when soft-keyboard appears.
For Example : If you don't want to resize the view, you can put the following line in manifest file. This will simply display the keyboard on top of the activity.
<activity android:windowSoftInputMode="adjustPan">
You can check other options for desired functionality.
For better understanding and more controls, you can refer this tutorial.
Hope, this will give you some hint about implementing your use-case.

dismiss a view from class extended by InputMethodService

I am created a custom keyboard. The keyboard is NOT an extension of the Keyboard class and does not use the Keyboard View class either. I have successfully created my keyboard so that it popups up. The keyboard is a LinearLayout I created from an xml file. Here is the problem: I can't get rid of it.
If it was an extension of KeyboardView, I would use
keyboard.closing();
but since its a LinearLayout, I don't have that method.
I then tried
keyboard.removeView(keyboard);
I didn't expect this to work, and it didn't.
Finally, I tried
keyboard.removeAllViews();
in hopes that it would sort of leave keyboard on the screen, but no one would no if all the views were removed. This did not work either.
Any suggestions?
Well if keyboard is the View you want to hide, try calling keyboard.setVisibility(View.GONE). If you want to remove it entirely you would have to find the parent view of keyboard and call removeView(keyboard) on that. I think the first approach is simpler though, depending on what you want.

Android: How can I use the space from objects with visibility GONE?

When I try to make a layout while working with the graphical layout interface in Eclipse (and not the xml) I came across with this problem:
Let's say that my main layout is only a simple button on the bottom of the screen,
when clicked the button opens up a text box that covers most of the screen.
note : I do this be setting the visibility of the text box from GONE to VISIBLE (and the other way around when I want to hide the text box).
Now (the text box is hidden) I want to use the extra space I have and add a button to the main layout.
normally this isn't much of a problem but since I have the text box covering almost the entire screen in the graphical layout I'm having a lot of trouble doing so (and this is just an example, I want to add more complicated things to my new gained space).
What can I do ? in the graphical layout I can't hide an object (like text box or button) and I drag another button to that space I can see/work with it.
set the android:visibility attribute to "gone" while designing the layout
You are going about this all wrong.
You should be using either a new activity or a diloag box to create a textbox that covers the entire screen or a ViewFlipper to create multiple views on your activity.
It appears that you want to do it from one layout so ViewFlipper would be the simplest choice here.
The documentation is available in the usual place:
http://developer.android.com/reference/android/widget/ViewFlipper.html
Some examples can be found at:
http://www.androidpeople.com/android-viewflipper-example
http://android-pro.blogspot.com/2010/09/using-view-flipper-in-android.html
EDIT
Your question isn't very clear so I have tried to give you my best guess from the information provided. Perhaps a diagram of what you are trying to do here might be more easily understood. Though as I stated a new activity or a dialog box might be better. So you could also look at using a dialog method:
http://www.androidsnippets.com/prompt-user-input-with-an-alertdialog

Categories

Resources