I'm trying to create an application on which I have to input numbers directly with a virtual keyboard. The problem is that the EditText Number, which is perfect for this purpose (only inputting numbers) is hiding the whole screen.
What I want is only the keyboard on the bottom half of the screen with the EditText showing the inputted number, but, even after a few times of searching, I can't find an answer. Can you please help me? this is really important.
First you can configure an inputType for your EditText:
<EditText android:inputType="number" ... >
also write <requestFocus /> in between <EditText> and </EditText>
What worked best for me is in Android Manifest for activity adding:
android:windowSoftInputMode="stateVisible"
I hope that helps you as well.
So you full tag will be:
<EditText android:inputType="number">
<requestFocus />
</EditText>
It will open keypad automatically when you start your activity.
Related
I want to keep the keyboard displayed at the bottom by default without using a text input which the user needs to tap.
I need to keep the keyboard at the bottom at all times.
Then I need to listen to the events of the keyboard.
How can I do this?
The workaround I implemented was adding an invisible text box somewhere on the screen and then set it as focused manually.
Just in case someone else might stumble upon this, OP's self answer works. In order to set focus manually, you'll need to get the ref to the hidden input.
<TextInput
ref={input => (this.textinput = input)}
style={{ display: 'none' }}
/>
then elsewhere in the code, you focus manually by
if (this.textinput) {
this.textinput.focus();
}
This answer is way too late to do the OP any good, but for others:
You can't do this. In iOS, the operating system, keyboards simply don't/can't work this way. iOS never shows a keyboard without an active text input focus, and there is no way for even a native iOS app to override this OS-level behavior. The OS itself prevents this from happening.
I've got two UITextViews containing data that should be recongised by the data detection, however whilst one works fine on both device and simulator there's one that only works under Simulator. I've attempted trashing the build from my device, cleaning the product down, removing derived data and nothing seems to resolve the inconsistency.
Link detection was enabled within Interface Builder, the data is passed in with a NSString stringWithFormat: formatted string and set with UITextView setText:. Set the same way for both, so there's no difference there, but it just doesn't seem to work correctly for one of them.
EDIT: On the device if I tap on one of the items that should detect as a link, it'll then turn blue and do link detection. I'm not setting any custom fonts or colours that could have an impact.
It appears that the trick is to setScrollable:NO. Seems to fix the problem, although if you need scrolling, I'm not sure what the answer will be...
Apparently this issue is caused by how iOS is currently handling the UITextView links. It is creating an NSAttributedString that turns sections of the text blue ( when the view contains a link ). So I've figured out that this bug only occurs when a link is the first text in the AttributedString, i.e. the first text in the text view. So it's easily fixed by prepending an whitespace to your text before setting it. Or overriding setText to " " + text;
Hope this helps guys
Basically I am new to iOS development. I have several text boxes where I want a user to enter a percentage (not letters) so I will only need a numeric keyboard. When the user has done this I also want them to easily get rid of the keyboard.
In the simplest way possible, just treat me like a drunken 5-year-old here, can someone guide me through the steps needed to do this?
Assuming an UITextField:
textField.keyboardType = UIKeyboardTypeNumberPad;
I am working on an iPad app which works in UIWebView, and I want to use a custom keyboard that contains only numbers (0-9) like iPhone numpad for some of the input fields.
Any suggestions or code sample please.
You can make the UIWebView display the number pad keyboard by setting the attribute in the input tag.
<input type="number" />
Apple already has a numeric keyboard that you can use.
You can programmatically set it using:
input type="number"
You can also set it through the Interface Builder.
Is there any option for primefaces keyboard component to accept numbers form both keyboard and mouse?
I'm using primefaces keyboard component with keypadonly option to enter numbers only.
I should be able to enter numbers either from physical keyboard or virtual keyboard.
If keypadonly is set to true, I'm not able to enter data using physical keyboard.
I don't have this problem if keypadonly only attribute is not used. Did someone experience this problem? If so please let me know how to handle it.
It seems to be intentional, if keypadonly is set to true a javascript will set the input to readonly="readonly".
You may try to use a custom layout (see http://www.primefaces.org/showcase/ui/keyboard.jsf ).
This migth work:
<p:keyboard value="#{keyboardBean.value}"
layout="custom"
layoutTemplate="123-close,456-clear,789-back,0"/>
or removing the readonly attribute with a custom javascript.