I am seeing a weird bug in my app and I was wondering if someone could help me fix it. I have a simple EditText with some existing Text, if I move the cursor to the top and hit the Enter key it moves the first line down and on top of the second line. I made a video to help with the visual of what I am seeing:
https://www.youtube.com/watch?v=vJfTDjBxdT4&feature=youtube_gdata_player
The phone is a stock Samsung Galaxy Nexus. I have tried to change the InputType to various other things but they all see to have the same issue. Here is the layout:
<EditText
android:id="#+id/editor_text"
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_weight="0.72"
android:gravity="top"
android:inputType="textMultiLine|textCapSentences|textAutoCorrect"
android:singleLine="false" >
</EditText>
This is a Jelly Bean issue with Hardware Acceleration here is the Google link:
http://code.google.com/p/android/issues/detail?id=38770
I verified that using the Software layer fixed the issue for me.
Related
Below is my code for EditText,
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/password_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/username_layout"
android:layout_marginTop="10dp"
android:layout_marginBottom="15dp"
app:hintEnabled="false"
app:passwordToggleEnabled="false"
app:passwordToggleTint="#color/white">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/login_password_input"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/login_username_input"
android:layout_weight="0.0"
android:drawableEnd="#drawable/password"
android:background="#drawable/round_bg"
android:hint="#string/login_password_hint"
android:imeActionLabel="#string/action_done"
android:imeOptions="actionDone"
android:inputType="textPassword"
android:maxLines="1"
android:nextFocusDown="#+id/submit_btn"
android:paddingStart="10dp"
android:paddingLeft="10dp"
android:text=""
android:textColor="#FFFFFF"
android:textColorHint="#FFFFFF"
android:textCursorDrawable="#null"
tools:ignore="RtlSymmetry" />
</com.google.android.material.textfield.TextInputLayout>
I am setting password eye icon programatically like below,
passwordLayout.setEndIconMode(TextInputLayout.END_ICON_PASSWORD_TOGGLE);
passwordLayout.setEndIconDrawable(GetDrawable.getDrawable("Show/Hide Password"));
passwordLayout.setEndIconTintList(ColorStateList.valueOf(getResources().getColor(R.color.color_white)));
This works fine in most of the devices. But getting below issue in Mi a2 Android Version 10.
I have two TextInputLayout for user name and password field
There is no issue while typing username field.
Next moved to password field. Now, the cursor stucked in first position and typing text is showed up in keyboard but not displayed in Edittext field. Only text is displayed after tapping somewhere else in screen
I am not sure why this happens in some devices
Found below question related to my issue. But no solution provided there.
TextInputEditText is not showing the typed text/number when typing
UPDATE
In this given a solution for my issue, Android Pie edittext does not adjustPan/resize while typing but using Hardware acceleration may lead to high memory usage. So afraid to use this solution.
is there any other way to solve this?
I tested the code on emulator on two android devices find nothing wrong with it used com.google.android.material:material:1.3.0
please update your color style it has no Legiblity
pan Adjuesment related issued loged in debug check that
try alpha or Rc MDC for libaray version bug
Finally you do is open issue at MDC github here
I seem to have quite a specific problem. I have two tablets, one runs on Android 6.0.1, the other on 5.1.1.
I have an activity and a fragment (the fragment is located on an activity). Each has an EditText element with the following layout:
<EditText
android:id="#+id/etInputForm_1_1"
android:layout_width="250dp"
android:layout_height="30dp"
android:layout_below="#id/tvDescription_1"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp"
android:cursorVisible="true"
android:imeOptions="actionNext"
android:paddingBottom="5dp"
android:paddingLeft="5dp"
android:paddingStart="5dp"
android:textColor="#color/Black"
android:textSize="15sp"/>
The problem is, if I test it on the device with Android 6.0.1, everything seems to be ok, I can input text wherever I want to, however on the device with 5.1.1, the EditText in the fragment always seems to be empty no matter how many letters I type (the EditText in the activity still works fine).
But the logs still show that the text IS there (however we can't see it).
Anyone had similar problem and a solution to this?
I had a similar issue where the edit text hint wouldn't go away (representing text was in the field) and no text would show up when I was typing but my logs showed text was indeed in the field. I also had an issue where my spinners would not show the selected option
I solved it by enabling hardware acceleration for my application. Since it is enabled by default (I believe) I removed this line from my <application></application> section of my manifest file: android:hardwareAccelerated="false"
My issue resolved after removing following line from edit text.
android:textAllCaps="true"
The problem was resolved by using android.app.Fragment instead of android.support.v4.app.Fragment. Seems that the support fragment class is buggy when using on tablets with Android 5.1.1.
I've got an ordinary TextView working correctly on all phones except on certain Samsung devices (Galaxy S2 and S3 for the moment, according to user feedback) and only when using the Helvetica S font (other pre-installed Samsung fonts work correctly).
The problem is that the text gets clipped a bit on the right, instead of wrapping correctly. I still cannot post images, but the issue is the same that happens in this question: Android text gets clipped on some devices (and with the difference that I'm not using Hindi fonts).
This is my TextView and its layout:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical"
android:paddingTop="24dp"
android:paddingBottom="32dp"
android:paddingLeft="#dimen/general_padding_sides"
android:paddingRight="#dimen/general_padding_sides"
>
<TextView
android:id="#+id/help_01"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="#dimen/help_text_size"
android:fontFamily="sans-serif-light"
android:textColor="#android:color/black"
/>
I tried setting clipToPadding to false on the layout to see if the clipped text could be seen, but the text gets clipped the same way, and I can't make any tests in situ as I don't have any Samsung test device yet (I depend on user feedback).
The thing is I couldn't find any other reference to this problem apart from the question linked above, but if there is a bug with Helvetica S in Samsung devices, I guess someone else should have faced this problem before.
Has anyone encountered this problem? Is there any xml property that I am missing and could prevent this behavior or is this just a Samsung bug?
I am facing an issue in one phone (till yet). My app uses Hindi fonts. It shows well on emulator, tab, many other phones too. But one of the phone which I am using for testing purpose is showing the text going cut from sides.
I tried almost everything for putting it in the right order but none worked. Here posting the screenshots of two of my test phones and the text.
The screenshot with error:
The screenshot of other phones: and the expected one too:
What could be the reason and how can I solve it? Please let me know!!
TextView configs I am using:
<TextView
android:id="#+id/A_lbl_mandir"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="#string/Abt_mandir"
android:textAlignment="center"
android:textColor="#80000A"
android:textSize="35sp" />
EDIT: My complete activity xml:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<TextView
android:layout_width="wrap_content"
android:id="#+id/text"
android:layout_height="wrap_content"
android:textSize="20sp"
android:text="#string/hello_world" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:layout_below="#id/text" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20sp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:padding="5sp"
android:text="#string/test"/>
</ScrollView>
</RelativeLayout>
I have tried and deleted many other things especially for this phone. But unable to solve the issue!
this occurs in 4.1.2 and its documented as a bug in Google which they have fixed in 4.2.
https://code.google.com/p/android/issues/detail?id=34432
This happens with unicode fonts where the Android OS is not able to calculate the length of the text.
try this.
<ScrollView
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_below="#id/text"
android:padding="5dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20sp"
android:gravity="left"
android:padding="5sp"
android:text="#string/test"/>
</ScrollView>
All right! Found another phone with same issue. In that phone too, the text was clipped. I guess there is some problem with the phone. Because even popular apps like Whatsapp has got the same problem on that device. The Hindi text was cut same as shown in the images above.
Possible fix for that issue: (if someone gets that n what I am doing now.) I realised that browser shows the hindi fonts well on that. So better make a native app on html, javascript especially for such devices and view the HTML using WebView.The application will get a little slow but we have to do it Until we get the actual problem creating it.
Please note: this is not a solution, but a fix to make that work. Better known as "JUGAAD" in hindi.
On some phones (specially on Samsung ones) some custom fonts are cuted off (or clipped). I had this with custom italic font. Some say that you can edit font to add some kind of padding (i can't confirm that because my lack of knowledge of editing fonts) but:
- EditText/TextView add some padding from xml
- Ellipsize (on some devices messing with this helps displaying text correctly)
Also could you post screenshot with enabled developer options to draw layout bounds, this could help to resolve your problem if above solutions won't help
I have a AutoCompleteTextview when I enter a character then sometimes it leads to Google search screen of android. I dont know y this is so.
Layout Declaration for AutoCompleteTextview is:
<AutoCompleteTextView
android:id="#+id/search_box"
style="#style/AutoSuggestList"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/bar_search"
android:maxLength="1024"
android:dropDownWidth="match_parent"
android:ellipsize="end"
android:hint="#string/hint_In_searchBar"
android:inputType="text|textNoSuggestions"
android:paddingLeft="11dp"
android:layout_alignParentRight="true"
android:singleLine="true"
>
</AutoCompleteTextView>
There is also a search Icon over this view at right corner.
But only typing a character itself is leading to Google search.
Example image :
(source: fonearena.com)
Device in which I found this issue: Samsung galaxy S, O.S. version : 2.3.4
Please any suggestions for the same.?