I have these EditText in my app:
<EditText
android:id="#+id/text_url_servidor"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="10dp"
android:hint="#string/text_url"
android:singleLine="true"
android:textSize="7pt" />
and
<EditText
android:id="#+id/login_password"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#id/login_username"
android:hint="#string/login_password"
android:password="true"
android:singleLine="true"/>
When I run the app, the first one shows the letters pop-up, but not the second one. They are in different layouts (xml). Both are inside a RelativeLayout. The only difference is that the first one are shown in a Dialog. Why second one is not showing letters as pop-up? Thanks.
I think it may be because of android:password="true" remove it and try
Related
I have a strange problem. Whatever in Edittext , all letters are autocapitalize. I don't want that. I want text to appear same as user types which is lower and uppercase both.
Here is my code
<EditText
android:layout_width="match_parent"
android:textAppearance="? android:attr/textAppearanceSmall"
android:layout_height="150dp"
android:cursorVisible="true"
android:layout_marginBottom="15dp"
android:hint="Feedback"
android:background="#drawable/edit_text"
android:textCursorDrawable="#null"
android:gravity="top"
android:inputType="textMultiLine"
android:padding="8dp"
android:id="#+id/feedback_input" />
Make android:textAllCaps="false" in your edit text.
In my app I'm using EditText in a few different places. However, whenever I click any of these EditText's, the soft keyboard appears and then there is a short delay where it seems like everything freezes for about one or two seconds before I can type.
Same thing happens when I am done typing and click the back button, the soft keyboard disappears and then there is a white square instead where it took place and it again freezes for one or two seconds.
I have searched for it and I found this, I tried it but didn't change anything. What can be the cause for this and how can I fix it?
<?xml version="1.0" encoding="utf-8"?>
<TextView
android:id="#+id/weekTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:textColor="#color/PaleBlack"/>
<RelativeLayout
android:id="#+id/desiredHoursContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toEndOf="#id/weekTextView"
android:layout_toRightOf="#+id/weekTextView">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toLeftOf="#+id/desiredHoursEditText"
android:layout_toStartOf="#id/desiredHoursEditText"
android:paddingEnd="5dp"
android:paddingRight="5dp"
android:text="#string/desired_hours"
android:textColor="#color/PaleBlack"/>
<EditText
android:id="#+id/desiredHoursEditText"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_toLeftOf="#+id/unitTextView"
android:layout_toStartOf="#+id/unitTextView"
android:background="#drawable/main_border_square"
android:inputType="number"
android:maxLength="2"
android:minWidth="40dp"
android:textAlignment="center"
android:textColor="#color/PaleBlack"/>
<TextView
android:id="#+id/unitTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:paddingLeft="5dp"
android:paddingStart="5dp"
android:text="h"
android:textColor="#color/PaleBlack"/>
</RelativeLayout>
I fixed it by adding the following line to my activity in the manifest, not sure why tho.
android:windowSoftInputMode="adjustNothing"
Can someone point me on how to limit the edittext as one line only?
screenshot:
my xml:
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Full Name"
android:id="#+id/textView_data2"
android:textSize="20sp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:maxLines="1"
android:gravity="fill_vertical" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Full Name"
android:scrollHorizontally="false"
android:id="#+id/textView_data2"
android:textSize="20sp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:maxLines="1"
android:inputType="textPersonName"
android:gravity="fill_vertical" />
Just add into your XML-File android:maxLines="1"
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Full Name"
android:id="#+id/textView_data2"
android:textSize="20sp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:inputType="text"
android:imeOption="actionNext"
android:gravity="fill_vertical" />
android:inputType="text"
android:imeOption="actionNext"
these two lines are the catch. you better use actionDon in imeOption
i.e.,
android:imeOption="actionDone"
use this and you are all good :)
P.S. there are multiple types of imeOption provided by android. We usually use these imeOptions for our softKeyboardInput where we need to change enter button of our keypad to anything else.
e.g., actionDone : DOne button
actionNext :Go to next editBox and etc,
These imeOption only works with inputType="text|number|..i.e. you need to specify a input type for using imeOption.
Hope it will help you :)
I need help with my app. This is my xml file with Relative layout, and I need to jump to the next edittext after pressing Enter key.
But there is a problem, if I'm writing to the editTextKm and press Enter key, it jumps to the editTextFullTank, but I need to jump to the editTextManufactYear. How to do it?
<EditText
android:id="#+id/editTextSPZ"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:maxLength="11"
android:inputType="textCapCharacters"/>
<EditText
android:id="#+id/editTextKm"
android:layout_width="180dp"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/editTextSPZ"
android:inputType="number"
android:maxLength="7"/>
<EditText
android:id="#+id/editTextManufactYear"
android:layout_width="120dp"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/editTextKm"
android:layout_alignBottom="#+id/editTextKm"
android:layout_alignParentRight="true"
android:layout_marginRight="2dp"
android:layout_toRightOf="#+id/editTextKm"
android:inputType="number"
android:maxLength="4" />
<EditText
android:id="#+id/editTextFullTank"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/editTextKm"
android:inputType="number"
android:maxLength="3"/>
<EditText
android:id="#+id/editTextReserveTank"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="#+id/editTextManufactYear"
android:layout_toRightOf="#+id/editTextFullTank"
android:inputType="number"
android:maxLength="3" />
<EditText
android:id="#+id/editTextNote"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_below="#+id/editTextFullTank"
android:capitalize="sentences"
android:singleLine="false"/>
For further details you can consult Anddroid Developer blog.
Focus movement is based on an algorithm which finds the nearest neighbor in a given direction. In rare cases, the default algorithm may not match the intended behavior of the developer. In these situations, you can provide explicit overrides by using these XML attributes in the layout file:
android:nextFocusLeft="reference"
android:nextFocusRight="reference"
android:nextFocusUp="reference"
android:nextFocusDown="reference"
add the attributes:
android:nextFocusDown="#id/your_next_edit_text_to_focus" to each EditText according to what you need.
You can also use :
android:nextFocusUp="#id/your_next_edit_text_to_focus"
android:nextFocusLeft="#id/your_next_edit_text_to_focus"
android:nextFocusRight="#id/your_next_edit_text_to_focus"
In the affirmation text field I press the newline button and it puts spaces.
However after I click done the field actually has the correct new lines (second screen capture).
Its not a problem with the device as it works correctly for the compose mail filed in the gmail app. Which is how I would like this to work.
<TextView
android:inputType="textMultiLine"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dip"
android:text="#string/edit_affimation"
/>
<EditText
android:id="#+id/affText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text=""
android:textSize="18sp"
android:singleLine="false"
>
</EditText>
Figured it out
<EditText
android:inputType="textMultiLine"
android:id="#+id/affText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text=""
android:textSize="18sp"
android:singleLine="false">
</EditText>
Add following attribute:
android:inputType="textMultiLine"
You can also do it programmatically:
Editext txt = (EditText) findViewById(R.id.affText);
txt.setRawInputType(InputType.TYPE_TEXT_FLAG_MULTI_LINE);