cwac RichEditText not working - android

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.

Related

How to change Android EditText keyboard color?

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" />

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);

Android: what is the inputType for username

I have an edit text on my xml layout to allow the user to enter his username,like this:
<EditText
android:id="#+id/etUsername"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType=""
/>
which type of inputType should i use to make the user enter his username, the username contains just letters small letter and capital letter and numbers
May I suggest textVisiblePassword|textNoSuggestions it gives you the normal keyboard with the option to display numbers but gets rid of the Android suggestions (they're pretty useless when typing in a username).
EDIT:
As pointed out by Hailwood, some users may like the added benefit of the suggestions provided by the Android keyboard. Upon reflection on the matter, perhaps a standard text might be more suited for this situation.
It's really a UX matter, you'll have to make a choice here.
I would recommend android:inputType="textVisiblePassword|textNoSuggestions" as some IME/Android-Version combinations seem to ignore textNoSuggestions but not textVisiblePassword. If suggestions are left on some IME will auto insert spaces or other punctuation and auto-capitalize text which can screw up logins.

With "inputType" set to "textFilter", android still reserves screen space for suggestions?

developing an android app here using API 7. I have an EditText that we use to filter down the list beneath it, so we set the inputType to textFilter so Android wouldn't suggest words or auto-complete.
However, when the user types a character they see the popup box in which they're doing the search shrink. It is clearly getting smaller to make room for the suggestion bar, even though the suggestion bar doesn't actually show.
Using textNoSuggestions instead appears to have the same result. Here is the snippet for the input box:
<EditText
android:id="#+id/search_edit"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:singleLine="true"
android:inputType="textFilter"
android:background="#null"/>
Has anyone experienced and overcome this behavior? It doesn't repro on SenseUI, but probably because SenseUI floats the suggestion bar instead of claiming screen real estate for it.
Try textNoSuggestions. I'm not sure what textFilter does, I was hoping to use it to limit input to 0-9 and A-F for a hex keyboard, but found this instead.
The only thing that works consistently in my experience is textVisiblePassword. This both prevents autocorrection and doesn't change the size of the field. Very annoying.

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