TextView gets clipped on Samsung devices using Helvetica S font - android

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?

Related

Downloadable font not displaying for Switch TextView

I'm using downloadable fonts for an app, and it's working just fine, however when I've tried to apply the font to the TextView of a Switch, my device won't display it and resorts to the default font - it displays the font correctly for TextViews in the same activity outside of the Switch component.
Strangely, the Android Studio layout design window shows the correct font, but when running on device, it doesn't seem to work correctly.
<Switch
android:id="#+id/switch1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:fontFamily="#font/baloo_bhai"
android:text="This is a switch"
android:theme="#style/AppTheme.Switch"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/editText2" />
This is the display in Android Studio:
This is from my device:
It transpires this is a known issue Google Issue #63250768
A fix was located in another StackOverflow question however downloadable fonts will not work with this method - until a resolution, font files must be embedded into the application, as .XML fonts will not work.
Great job, Google!

Samsung Galaxy Tab 3 7.0 Android 4.4.4: TextView Html.fromHtml does not work

I have this code to show green feedback stars in a TextView:
Spanned sp = Html.fromHtml("<font color=\"#00dd00\">★</font>");
tv.setText(sp);
and it works on all devices I've tested beside the one in topic.
I cannot understand why.
A big problem is that the device is not mine and I don't know when I can get it back to test again, so I cannot reproduce the bug.
Another problem is that I've tested a couple of emulators with Android 4.4.4 and I could not find any problem.
Is there another way to show colored text in a safer way ?
Of course the stars are 5 and can be colored in a dynamic way (gray or green) otherwise it would not be a problem.
To be more detailed: if there are 2 green stars, the code is
Spanned sp = Html.fromHtml("<font color=\"#00dd00\">★</font><font color=\"#00dd00\">★</font>");
tv.setText(sp);
because it's created in a loop where <font color=\"#00dd00\">★</font> is a constant.
edit:
This is the definition of the TextView
<TextView
android:id="#+id/txtThumbnail"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="20dp"
android:layout_marginRight="40dp"
android:ellipsize="end"
android:gravity="center_vertical"
android:maxLines="1"
android:text=""
android:textSize="#dimen/elv_group_thumbnail_text_size"/>
"It does not work" means that the stars are shown but not green so it seems that the html color tag has no effect.
The solution, suggested by #CommonsWare, is to replace the TextView with a RatingBar
I had to create my own star pictures and a selector to handle them but, at the end, all is much simpler.
The proof is that I had to delete code :)
I don't know if this works on the Samsung device as well but I don't think that Samsung has fiddled also with the RatingBar.
As soon as I get the device, I test and post the result but, as far, this is an acceptable solution from my side.

Android xml design issues in version 4.1.2

I am working with android tablet's. which has now design issues in various version of android which is looking good in some version's and not looking good in some version's(xml layout designs).
i deployed my app in two different version(4.1.2 and 4.4.2) with same screen size 10 inch
But the result is not same since the design is somehow changed, Checkbox text is not aligned properly in 4.1.2 but 4.4.2 looks better as i expected..
What is the problem in my coding? i have attached the screenshot below and see the checkbox coding for the reference.
<CheckBox
android:id="#+id/rememberme"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="10dp"
android:paddingLeft="20dp"
android:button="#drawable/checkboxstate"
android:layout_marginRight="50dp"
android:paddingTop="10dp"
android:text="Remember me "
android:textColor="#000000" />
Helps Appreciated.!
Checkbox padding behaves differently before/after API 17. See this answer for a quick example of how to work around this. The same question contains more discussion of the underlying cause if you are interested.

Android EditText - Text overlay issue

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.

Problem with Checkbox text on Sony Xperia device

I am displaying a Checkbox on a layout xml.
The Checkbox text contain around 10 characters.
The problem is specific to Sony Xperia where the the Checkbox text is coming to the second line , specifically last 2 characters of the text on the second line.
<CheckBox android:id="#+id/roundCheck" android:paddingLeft="25dip"
android:button="#drawable/ic_uncheck_rect" android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_marginLeft="20dip" android:text="abcdefghij"
android:textSize="16sp"
android:textColor="#color/white" android:typeface="serif"
android:singleLine="true" android:checked="false"
android:layout_centerVertical="true"></CheckBox>
I have tested the mobile application on HTC Hero , Google Nexus One , Motorola Droid ,etc , but its working fine without any problem.
The problem is not getting reflected on the Sony Xperia emulator too.
Is adding the code, android:singleLine="true" , solve the issue , if it means that after a certain no of characters "..." will be added but the text will be in a single line ?
I don't have a mobile device to currently test.
Thanks in advance.
Warm Regards,
CB
If I understand you right, then you want the label of your checbox to not have multiple lines. If so you should use android:lines="1" instead of android:singleLine="true", because that is deprecated.
Usually that shouldn't break the behaviour, but I don't know if Sony did some "optimizition" on that ;)
You could also try using android:inputType="text", I'm not quite sure if that would be helpful though...
Hope I understood your problem right ...

Categories

Resources