How to change Android EditText keyboard color? - android

In iOS TextField has a property called Appeareance can have a Dark value. It will change the KEYBOARD color, (not the textfield itsels) But in Android I do not find the appropriate one for EditText, to change keyboard color to dark, or black.

There is no single "the keyboard" in Android. Android supports replaceable input method editors (a.k.a., soft keyboards). These are published by apps, including both pre-installed apps and apps installed by users. Anyone can write one of these.
AFAIK, there is nothing in the input method editor protocol that allows the editor to know anything about the color scheme of the app that happened to cause that editor to appear. But, even if the protocol included this information, the developer of the input method editor could choose to ignore it.
And, even if the developer of the input method editor knew about the general theme (light vs. dark) and chose to implement something for it, you still might not like what the developer chooses. After all, there is no universal definition of what a "light" or "dark" theme should look like. The input method editor developer might choose a deep purple color for "dark", and you went with dark brown.

Simple answer: you can't.
In Android the keyboard is not (only) a native feature. You can chose wether showing it or not and which keyboard to show.
But since it's another application, you can't access it directly, the only tasks you can do are opening the app with intent.
here you can find the official doc about it

Not sure what you are trying to achieve but note the following
The keyboard is a different application
The text appearance properties can be easily modified from the xml file
look at the example code below
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="40dp"
android:id="#+id/simple_list_item"
android:gravity="center_vertical"
android:padding="5dp"
android:paddingLeft="10dp"
android:paddingStart="10dp"
android:textSize="15dp"
android:typeface="serif"
android:textStyle="bold"
android:background="#color/white"
android:allowUndo="false"
android:text="Sample Still Testing"
android:textColor="#003325" />

Related

Android: How to remove customize keyboard button from keyboard?

Please find below the screenshot wherein the circular box shows the customize button option.
XMl Code:
<EditText
android:id="#+id/et_cost_per_mile"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:hint="Cost Per Mile(₤)"
android:inputType="numberSigned"
/>
All I want to remove :: button from keyboard.
You have change input type like..
android:inputType="phone"
You can not. This is your android keyboard app and you cant change it. The keyboard settings can be modified in the android settings. But obviously it depends on the user, not the developer.
The only way I think it will allow you to do that is that you include in your app a fake numeric keypad as a layer (Similar to the keyboard that appears when you have to type the pin of the app of your bank). However, I don't think this is worth it. With...
android:inputType = "numberSigned"
you are already blocking the user from entering letters or other characters, even if they change their keyboard.

cwac RichEditText not working

It appears trivial even on the 'Usage' section here
My edit text appears just the same, when i type on it everything appears as usual, when i select text everything is still normal. No "FORMAT" entry on the action mode. What am I doing wrong??
My layout:
<com.commonsware.cwac.richedit.RichEditText
android:id="#+id/editTextSermon"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="top"
android:hint="#string/type_the_sermon_here"
android:lines="10"
android:imeOptions="flagNoExtractUi"
android:inputType="textMultiLine">
<requestFocus/>
</com.commonsware.cwac.richedit.RichEditText>
In my activity:
sermonText = (RichEditText) findViewById(R.id.editTextSermon);
sermonText.enableActionModes(true);
From the documentation that is all I need to do, or is it?
On a side note part of the documentation reads like this:
On its own, by default, RichEditText provides one means of users applying formatting: the standard Ctrl-B for bold, Ctrl-I for italics, and Ctrl-U for underline work if there is a selection.
I've never seen a 'Control' button on an android keyboard. Whats going on? I just want to be able to bold, italicize and underline my text.

MultiAutoCompleteTextView not showing keyboard suggestions

I'm using MultiAutoCompleteTextView in my app. It's an awesome control in Android API. But there are a few issues I'm facing. One, the most annoying is, that on my Nexus 5, it doesnot shows keyboard suggestions. On Xperia Z, shows keyboard suggestions though. Unable to find the cause. Can anybody help/guide me about it? Here the XML of my MultiAutoCompleteTextView.
<MultiAutoCompleteTextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:hint="Post a question, idea or update"
android:gravity="top"
android:textColorHint="#9e9e9e"
android:textColor="#000000"
android:textSize="15sp"
android:padding="10dp"
android:background="#null" />
I have looked into the source code and found this in AutoCompleteTextView
// Always turn on the auto complete input type flag, since it
// makes no sense to use this widget without it.
int inputType = getInputType();
if ((inputType&EditorInfo.TYPE_MASK_CLASS)
== EditorInfo.TYPE_CLASS_TEXT) {
inputType |= EditorInfo.TYPE_TEXT_FLAG_AUTO_COMPLETE;
setRawInputType(inputType);
}
And in the javaDoc page of the InputType, TYPE_TEXT_FLAG_AUTO_COMPLETE defined as.
Flag for TYPE_CLASS_TEXT: the text editor (which means the application) is performing auto-completion of the text being entered based on its own semantics, which it will present to the user as they type.
It means that you have your own semantics for completion, which means that it is logical for the keyboard to disable its suggestions.
I think when you change the inputType with setInputType() method programatically you can disable this behaviour and get the keyboard suggestions.
You can try this:
mAutoCompletetextView.setInputType(EditText.TYPE_CLASS_TEXT | EditText.TYPE_TEXT_FLAG_AUTO_CORRECT);

How can I get the native Android Editbox

I have created an Editbox in XML using this code:
<EditText
android:id="#+id/txtEmail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="50dp"
android:inputType="textEmailAddress" >
</EditText>
The textbox renders like this:
How can I get the native android EditText with the orange borders when focused, white background etc. ?
I tried adding
android:background="#android:color/white"
but that only changes the background to white.
The style you are seeing is "native" for the Honeycomb (3.0) Android version, specifically, the new Holo-dark theme. The orange-borders-and-white-background look was last used in 2.3.* and has since been left behind.
Agree with the answer of neutrino: The style you are seeing is "native" for the Honeycomb (3.0) Android version, specifically, the new Holo-dark theme.
But still if you wants the EditText that you want then you need to set the style/theme inside the AndroidManifest.xml file:
<activity android:theme="#android:style/Theme.Light">
when we add view's from layout, it renders from framework, then add the properties we provided . so in your code, EditText is native EditText, which varies from device to device . so if you want look and feel over a particular device make your own style for that and use it .
Had the same problem...
Try using:
EditText usr=(EditText)findViewById(R.id.editText1);
usr.setBackgroundResource(17301528);
If you really want to older versions of the EditText iamges (from sdk/android-8/platforms/data/res folder), place thema in the drawable folder, create a StateListDrawable out of it, and set the background of the EditText as that Drawable. But why bother ? Let app users enjoy the default look and feel of their device.

Android - customized keyboard key and action

If you own Android phone you are no doubt have noticed how in the certain apps the keyboard layout can change from the standard issue to digits-only or to have .com or .net special buttons based on the text field input type (e.g. phone number). So I have 2 questions:
how to trigger this customization? I suspect it has to do with EditText format
Can this be taken even further if I want to add some custom buttons to inject a specific pattern? Say I would have an AND button which when pressed will add all uppercase " AND " surrounded by spaces to the text field. Can this be done?
What I'm not asking is how to capture some key combination in onKeyPress event and then populate text field with a pattern - I pretty much know how to do that already.
It is controlled by the android:inputType XML attribute (or the setInputType() method).
For info on the available options see the pages for the XML attribute or the object's method.
As an example, the following XML:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<EditText
android:text="example text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="phone" />
</LinearLayout>
will give you this layout:
whereas changing the inputType to textEmailAddress will give you this:
You can customize the "action" button as explained here, but I don't believe there's any way to do full customization of keyboards at this time, but I could be wrong.
The thing that concerns me is that "inputType" is listed as a deprecated property, meaning it may work for a while, but - eventually - Android will stop supporting it. Is there another alternative?
UPDATED: My bad - I'm confusing with inputMethod.

Categories

Resources