The problem is there is a edittext and I would like to set it default has a cursor on it (but not focus and hide the keyboard )
try
android:textCursorDrawable="#null"
android:cursorVisible="true"
<EditText
android:id="#+id/comment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="1dp"
android:background="#drawable/comment"
android:hint="#string/cmt"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:textColor="#AAACAD"
android:textColorHint="#AAACAD"
android:textCursorDrawable="#null"
android:cursorVisible="true"
android:textSize="15sp" />
but not works. Please help. Thanks a lot
#user782104
You can use this attribute android:windowSoftInputMode="stateHidden" in your AndroidManifest.xmlfile where you declare that Activity.
so this way cursor will be in edittext but keyboard will not display.
Related
Basically I'm trying to remove the suggestion underline from the editText and which is done by textNoSuggestions in editText . But now the problem is keyboard is not showing the enter button . So, I wonder how to show the enterKey even after adding the flag ?
Code:
<EditText
android:id="#+id/editTxt"
android:textColor="#001919"
android:gravity="start|top"
android:inputType="textNoSuggestions"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textCursorDrawable="#null"
android:background="#fff"/>
Try this,
<EditText
android:id="#+id/editTxt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#fff"
android:gravity="start|top"
android:inputType="textNoSuggestions|textMultiLine"
android:singleLine="false"
android:textColor="#001919"
android:textCursorDrawable="#null" />
<EditText
android:id="#+id/searchTextView"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_centerVertical="true"
android:layout_marginLeft="#dimen/marginSmall"
android:layout_toLeftOf="#+id/searchCloseIcon"
android:layout_toRightOf="#+id/searchIcon"
android:background="#drawable/rounded_rect_white"
android:backgroundTint="#android:color/transparent"
android:gravity="center_vertical"
android:hint=" Search Nearby Chat"
android:inputType="text"
android:lines="1"
android:maxLines="1"
android:textColor="#color/black"
android:textColorHint="#color/black38"
android:textSize="#dimen/sunheading" />
Initially I can see cursor in edittext but after setting its visibility gone
and
again making visible its not visible in edittext.
May I know what can be the solution for this?
to show cursor,
android:cursorVisible="true"
android:focusable="true"
android:focusableInTouchMode="true"
and In your EditText, use the property: to make it drawable
android:textCursorDrawable="#drawable/blue_cursor"
Setting the android:textCursorDrawable attribute to #null should result in the use of android:textColor as the cursor color
programatically :
searchTextView.setCursorVisible(true);
searchTextView.requestFocus();
When you set your container visibility VISIBLE also try to request focus to your EditText
findViewById(R.id.searchTextView).requestFocus();
android:textCursorDrawable="#drawable/color_cursor"
I have a simple EditText inside my scrollview.
All the other elements are working just fine, however i won't get the usual EditText behaviour on click (Keyboard doesn't appear, I can't write).
Here's my xml for the field.
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/enterWishprice"
android:background="#drawable/edit_back"
android:focusable="true"
android:focusableInTouchMode="true"
android:text="0 F€"
android:gravity="center_vertical|center_horizontal"
android:textSize="26dp"
android:inputType="number"
android:layout_margin="10dp" />
As you can see I already tried setting focusable/inTouchMode.
I also tried setting a click listener on the field to manually open the keyboard which works just fine. However I still can't type anything into the field.
After that i tried using requestFocus in the clicklistener without any result.
Furthermore I tried clearFocus on the EditText as well as the surrounding ScrollView - also not working.
Hopefully you can give me a hint cause I'm out of ideas..
Thanks in advance!
The attribute Enabled must be set to true.
<EditText
android:id="#+id/room_message"
android:layout_width="164dp"
android:layout_height="46dp"
android:clickable="true"
android:ems="10"
android:enabled="true"
android:focusableInTouchMode="true"
android:hint="#string/prompt_message"
android:inputType="textPersonName"
android:textColor="#FFFFFF"
android:textSize="18sp"
android:textStyle="italic"
/>
But i have got another problem where the EditText won't lose focus....
try like this
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/enterWishprice"
android:background="#drawable/edit_back"
android:focusableInTouchMode="true"
android:text="0 F€"
android:gravity="center_vertical|center_horizontal"
android:textSize="26dp"
android:inputType="number"
android:layout_margin="10dp">
<requestFocus />
</EditText>
I had an issue with setting hint in Arabic language. Please refer Alternating edit text hint not visible for Arabic language
for details. The issue was with the use of inputType in the xml. I have removed it and now a normal keypad appears onclick of the edittext field. But I want the user to enter numbers only and I want numerical keypad to appear. How to do it?
In short, the use of inputType will not display the Arabic content and if it is not used then I am getting alphabetical keypad.
Please help, thanks in advance
hope you can use this property android:numeric="integer" and please remove singleline property if you are using it.
<EditText
android:id="#+id/et_account_no"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#android:color/transparent"
android:cursorVisible="true"
android:gravity="right"
android:hint="#string/hint_account_no"
android:imeOptions="actionNext"
android:numeric="integer"
android:maxLength="12"
android:textColor="#android:color/black"
android:textSize="20sp"
android:padding="#dimen/edittext_padding">
</EditText>
Use android:inputType="number" or android:inputType="phone" it should give you numeric keypad on click of edit text:
Following is the snippet from my xml, this should help:
<EditText
android:layout_gravity="start"
android:textAlignment="viewStart"
android:hint="my hint"
android:inputType="phone"
android:id="#+id/Nummm"
android:paddingStart="8dp"
android:paddingLeft="8dp"
android:textDirection="rtl"
android:gravity="center_vertical"
android:layout_width="match_parent"
android:background="#android:color/transparent"
android:textColorHint="#767676"
android:backgroundTint="#android:color/transparent"
android:layout_height="fill_parent"
tools:ignore="RtlCompat" />
I was wondering if its possible to change magnifying glass on the Search button to text "Search". We want to preserve the imeOptions setting to android:imeOptions="actionSearch" because we respond to a certain event.
Here is what I have:
<EditText
android:id="#+id/txtSearch"
android:textSize="14px"
android:textColor="#color/main_text_black"
android:layout_width="189px"
android:layout_height="fill_parent"
android:imeOptions="actionSearch"
android:gravity="center_vertical"
android:singleLine="true"
android:background="#null"
android:layout_alignParentLeft="true"
android:layout_marginLeft="24px"/>
Tried this:
<EditText
android:id="#+id/txtSearch"
android:textSize="18dp"
android:textColor="#color/main_text_black"
android:layout_width="247dp"
android:layout_height="fill_parent"
android:imeOptions="actionSearch"
android:imeActionLabel="Search"
android:gravity="center_vertical"
android:singleLine="true"
android:background="#null"
android:layout_alignParentLeft="true"
android:layout_marginLeft="38dp"/>
This only works in landscape mode which our app does not support and the word Search shows up in the wrong place.
You can try it!
<EditText
android:id="#+id/edt_search_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:imeOptions="actionSearch"
android:inputType="text"/>
No, this is impossible unless you implement your own Keyboard for that EditText. The Text (or icons) on the keys of a keyboard is controlled by the person who wrote the keyboard.