android-textattributes

Text view returning wrong text size

别说谁变了你拦得住时间么 提交于 2019-12-12 18:34:27
问题 I need to get the text size of the text view so that I would increment in text size while user pressing the button which indicates that it helps in increasing the text size in the text view. Let me clear what I have done so far i have a text view and setting its text size through dimen folder <TextView android:id="@+id/tv_text" android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="2dp" android:text="@string/flash" android:textSize="@dimen/tv_text_fontsize"

TextView taking/consuming too much space above and below the text

橙三吉。 提交于 2019-12-12 00:24:56
问题 The text view encircled has too much space above and below its text. It is inside the text view (not above and below of it). I neither used margins nor paddings but it is remained there. The xml code is there. <TableRow android:id="@+id/tbRow" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/viewLineSeparator" android:layout_gravity="top" android:layout_marginBottom="2dp" android:layout_marginTop="1dp" android:gravity="top" android:weightSum=

android get textappearance runtime

眉间皱痕 提交于 2019-12-10 11:05:10
问题 I have overriden the textview class and I want to perform some things when the textappearance is small. How do I check the textappearance that has been set by the xml layout file? 回答1: i have found a workaround: private int getTextAppearance(AttributeSet attrs, int defStyle) { int answer = defStyle; for(int i=0; i<attrs.getAttributeCount(); i++) { if(attrs.getAttributeNameResource(i) == android.R.attr.textAppearance) { String attrStringValue = attrs.getAttributeValue(i); if(attrStringValue !=

Triangular Bullet in Android TextView for Pre-Lollipop devices

牧云@^-^@ 提交于 2019-12-08 13:25:32
I Tried character encoding "& #8227;"---> and java strings "\u2023" and also tried pasting directly the Triangular Bullet "‣". I tried both 1) Directly specifying in android:text attribute and 2) Extracting from resource. All the methods specified above working fine with the Lollipop but none of them working in 4.2.2 and previous android versions. Instead of the Bullet it is showing some rectangular box. any ideas how to solve it ?? For displaying ▶, use \u25b6 (for displaying ▷, use \u25b7 ). Tested on a 2.2 (Froyo) emulator: works . This is a very useful resource: http://unicode-table.com/en

Triangular Bullet in Android TextView for Pre-Lollipop devices

强颜欢笑 提交于 2019-12-08 03:59:50
问题 I Tried character encoding "& #8227;"---> and java strings "\u2023" and also tried pasting directly the Triangular Bullet "‣". I tried both 1) Directly specifying in android:text attribute and 2) Extracting from resource. All the methods specified above working fine with the Lollipop but none of them working in 4.2.2 and previous android versions. Instead of the Bullet it is showing some rectangular box. any ideas how to solve it ?? 回答1: For displaying ▶, use \u25b6 (for displaying ▷, use

android get textappearance runtime

可紊 提交于 2019-12-06 11:19:46
I have overriden the textview class and I want to perform some things when the textappearance is small. How do I check the textappearance that has been set by the xml layout file? i have found a workaround: private int getTextAppearance(AttributeSet attrs, int defStyle) { int answer = defStyle; for(int i=0; i<attrs.getAttributeCount(); i++) { if(attrs.getAttributeNameResource(i) == android.R.attr.textAppearance) { String attrStringValue = attrs.getAttributeValue(i); if(attrStringValue != null) { attrStringValue = attrStringValue.replace("?", ""); answer = Integer.parseInt(attrStringValue); } }

Add http://www. in the text if not Exist

不羁岁月 提交于 2019-12-04 11:35:17
问题 How can I know that some text contain "http://www." I want to show domain in Web View. Domain name is written in TextView but there is no restriction to add prefix. If user didn't enter it I have to add and display URL in webview. 回答1: You can do like this String url = textView.getText().toString(); if(!url.startsWith("www.")&& !url.startsWith("http://")){ url = "www."+url; } if(!url.startsWith("http://")){ url = "http://"+url; } You can use this url to display content in WebView Hope this

Add http://www. in the text if not Exist

做~自己de王妃 提交于 2019-12-03 08:28:45
How can I know that some text contain "http://www." I want to show domain in Web View. Domain name is written in TextView but there is no restriction to add prefix. If user didn't enter it I have to add and display URL in webview. You can do like this String url = textView.getText().toString(); if(!url.startsWith("www.")&& !url.startsWith("http://")){ url = "www."+url; } if(!url.startsWith("http://")){ url = "http://"+url; } You can use this url to display content in WebView Hope this will solve your problem just modified @silwar answer and add https : if(!url.startsWith("www.")&& !url

Android EditText Memory Leak

拜拜、爱过 提交于 2019-11-30 07:31:33
Alot of people are noticing EditText in an activity is holding a Strong Reference to an Activity even once its finished. To be clear this EditText is inside a layout and inflated, there is no Listeners set. This only happens on certain devices e.g. Samsung Galaxy S4 (Android 4.2.2) and others. Many post about this still no solution. First here is some useful posts. (Eventually GC will clean this so its not technically a leak, but for heavy memory apps it takes way to long and will cause OOM) Android Samsung Memory leak in EditText Why does EditText retain its Activity's Context in Ice Cream

Android EditText Memory Leak

南笙酒味 提交于 2019-11-30 07:02:57
问题 Alot of people are noticing EditText in an activity is holding a Strong Reference to an Activity even once its finished. To be clear this EditText is inside a layout and inflated, there is no Listeners set. This only happens on certain devices e.g. Samsung Galaxy S4 (Android 4.2.2) and others. Many post about this still no solution. First here is some useful posts. (Eventually GC will clean this so its not technically a leak, but for heavy memory apps it takes way to long and will cause OOM)