custom keyboard expands edittext to half of the screen - android

is there any way to avoid a custom keyboard resizing my edittext to half of the screen.
is use this command
editTextKeyboard = new EditText(this);
editTextKeyboard.requestFocus();
editTextKeyboard.setAlpha(0);
editTextKeyboard.setSingleLine();
editTextKeyboard.setFocusableInTouchMode(true);
//editTextKeyboard.setVisibility(View.INVISIBLE);
addContentView(editTextKeyboard, layoutParamsCompleteLayout);
it also changes the alpha level.
would be glad for any support

use android:imeOptions:flagNoFullscreen in xml file or use editTextKeyboard.setImeOptions(EditorInfo.IME_FLAG_NO_FULLSCREEN)
Here is link for reference
1)link1
2)link2

Related

Android - EditText error changes position on keyboard open/close

I am using editText.setError() attribute but the onKeyboard open/close the error float message changes position to be many pixels higher than the editText instead of being right under it.
I have added:android:windowSoftInputMode="adjustPan" to the activity at the manifest file and at the EditText xml.
How can i fix it?
Yeah,that's your xml maybe some error.you can Modify the layout ,mostly the edittext layout group ,you should change the background to transparent bellow the windowSoft. In a word ,take notice the layout ,Clever use of transparent at the bottom .

making the KeyboardView transparent

I am making my own InputMethodService.Everything is working fine.But I have one issue.I want to make the KeyBoard view transparent.That means the keypad view will cover the enter screen & the user can see the whole screen while typing. I tried a lot to make it TRANSPARENT by setting BACKGROUND COLOR,DRAWABLE,but could not success. Please suggest me how to make a custom TRANSPARENT Keypad.
Does using the method setTheme (int theme) work?
In my configuration setting
android:background="#android:color/transparent" as a property of
android.inputmethodservice.KeyboardView and using slighltly transparent custom key drawable selector i.e. android:keyBackground="#drawable/custom_transparent_key"
works just fine.
In your KeyboardView XML file put
android:alpha="0.5"
Or in your OnCreateInputView set
keyboardView.setAlpha((float) 0.5);
Reference : How to make a background 20% transparent on Android

Creating multiline Edit view in android with coding

I have created an EditText object dynamically but I haven't been able to create a multi-line EditText. I have tried this:
EditText et1 = new EditText(this);
et1.setHint("Enter Your Address");
et1.setSingleLine(false);
et1.setHorizontalScrollBarEnabled(false);
et1.setInputType(android.text.InputType.TYPE_TEXT_VARIATION_POSTAL_ADDRESS);
et1.setLines(7);
Thanks.
Include this in your code:
et1.setMaxLines(maxlines);
Or you can set the specific height for the edit text.
If you want the text to wrap to the next line, add TYPE_CLASS_TEXT to the MULTI_LINE flag:
textArea.setInputType(InputType.TYPE_CLASS_TEXT|InputType.TYPE_TEXT_FLAG_MULTI_LINE);
It is the line:
et1.setInputType(android.text.InputType.TYPE_TEXT_VARIATION_POSTAL_ADDRESS);
that is the problem. Take that out.
setMaxLines doesn't matter much unless you want to set a max number of lines. You should also avoid setting the height to something specific. WRAP_CONTENT works great.
Even changing it to:
et1.setInputType(android.text.InputType.TYPE_TEXT_FLAG_MULTI_LINE);
forces it to a single line edit, which seems odd.
This doesn't work either:
et1.setInputType(android.text.InputType.TYPE_TEXT_FLAG_CAP_SENTENCES);
which is really freakin irritating. Seems like an android bug...
You also might want to set the vertical scroll on and gravity so it can scroll up and down and starts in the top left.
et1.setGravity(Gravity.TOP|Gravity.LEFT);
et1.setVerticalScrollBarEnabled(true);
What worked for me is:
et1.setSingleLine(false);
et1.setHorizontalScrollBarEnabled(false);
et1.setVerticalScrollBarEnabled(true);
et1.setMinLines(minLines);

How to add "[more...]" at end of text in android app

I am creating an app in android and I am parsing text. After I parse the text, the text appears fine. However, I don't want all of the text to appear (i.e. all lines to appear together).
Example -
Text that appears in app:
A Turing machine is a device that manipulates symbols on a strip of tape according to a table of rules.
What I want to show:
A Turing machine is a device that manipulates [more...].
So when the user taps on the [more...], the rest of the text will appear in a new window.
How do I incorporate the "[more...]" part?
Thanks =)
declare in your text view properties in the layout file
android:ellipsize="true"
that should do it.
use android:singleLine = "true" and
fix the width of your textview like android:layout_width = "150dp", then append [more...] at the end of text and make it as link, which should be clickable
Refer to this, to do what you want...

How to allow the user to select a text range in a TextView (Similar to EditText)

I've got a TextView that I would like to allow the user to select a range of text from within it. The TextView takes up the entire width and height of the device (minus some padding and a title at the top). In an EditText if you long-click you get a selection overlay that allows you to set your selection left and right bounds. I'd like this functionality in a TextView. I've read that in API level 9 (2.3) (http://developer.android.com/sdk/android-2.3.html) there are new text selection controls, but I'm having difficulty implementing this. I'm doing this right now:
eic = new InputConnection( bookTextView );
eic.beginBatchEdit();
But it doesn't do anything noticable. Does anyone know how to use InputConnection correctly? Thanks.
Edit: I don't necessarily need to use what I was attempting above. I ultimately want to use either a TextView or an EditText which looks and feels like a TextView and be able to select text using a dragging cursor. Then I would like to manipulate the selected text with various context menu options (or a menu that pops up above the selected text).
Here is an idea.. Add an EditText with a TextView background, Here is an example
<EditText
android:text=" This is not an editable EditText"
android:id="#+id/EditText01"
android:layout_width="wrap_content"
android:textColor = "#android:color/white"
android:editable = "false"
android:cursorVisible="false"
android:layout_height="wrap_content"
android:background = "#android:drawable/dark_header">
</EditText>
add this to your xml in the place of TextView
You can enable the TextView's Spannable storage. See Highlight Text in TextView or WebView for an example.
See also:
http://developer.android.com/reference/android/text/Spanned.html
You could display the text in a WebView and enable text selection. If you want to only use a textview/edittext, here is an answer that might help you and here is information on the Spannable class that might help you accomplish what you want.
Actually, you do not have to develop this feature by yourself. You just need to use EditText instead TextView, while you set the android:editable of EditText to false. My idea is the same as sandy's.
My code is here, hope it may help you:
https://stackoverflow.com/a/11026292/966405
After long internet surfing to find a solution, i prefered create my own class
https://github.com/orionsource/SelectableTextViewer
Goal features:
Easy to use - only one class
Support for text and Html.fromHtml
Can be in ScrollView with correct touches
Cursors can be redefined
Color of selection can be redefined
All the above solutions either too long or not working for me.
What you need is to add just textView.setTextIsSelectable(true)
in your activity or fragment or adapter.

Categories

Resources