text-size

Changing text size inside Tabs

早过忘川 提交于 2019-12-01 18:40:56
I am designing my app for various screen sizes,but I have a small problem. I can't change the size of the text inside the tabs. Here is what I did. Firstly I created my own style. <style name="MineCustomTabText" parent="TextAppearance.Design.Tab"> <item name="android:textSize">22sp</item> </style> And then I use this style to the appropriate xml file. <?xml version="1.0" encoding="utf-8"?> <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" xmlns:app=

is there any-way to use SpannableString in TabLayout?

别来无恙 提交于 2019-12-01 17:46:55
I want to set the title of the TabLayout with two different text sizes. Like the given image below. Or the other way around to achieve this! I have tried with SpannableString like give below. This snippet is in the for loop till 5! SpannableString mSpannableString= new SpannableString(s); mSpannableString.setSpan(new RelativeSizeSpan(2f), 0,5, 0); // set size mSpannableString.setSpan(new ForegroundColorSpan(Color.RED), 0, 5, 0);// set color mTabLayout.getTabAt(i).setText(mSpannableString); But as mentioned by CommonaSware setText() is not taking the rich content! TabLayout 's default style for

android eclipse using string resource for text size in layouts

我怕爱的太早我们不能终老 提交于 2019-12-01 03:56:38
问题 I want to be able to store a font size (18sp) in a resource so that a lot of my layouts will use so that I can easily change the size in the future if I need to. I've a string in a string resource file with "18sp" as the value, and I can call it in the layout editor by setting the text size to "@strings/string_name". At that point everything is fine, and the text is changed to the correct font. The problem is once I try to test that on an actual device I get : 04-13 12:01:01.210: E

How Can I to Change Text Size in RemoteViews

人盡茶涼 提交于 2019-11-30 09:09:38
Under RemoteViewsService.RemoteViewsFactory public RemoteViews getViewAt(int position) { final int itemId = (position % 2 == 0 ? R.layout.light_widget_item : R.layout.dark_widget_item); RemoteViews rv = new RemoteViews(mContext.getPackageName(), itemId); rv.setTextViewText(R.id.widget_item, text); // rv.setTextSize(mPrefs.getTextsize().getValue()); return rv; } How can I change the text size programmatically? How about the setFloat() method? rv.setFloat(R.id.widget_item, "setTextSize", mPrefs.getTextsize().getValue()); 来源: https://stackoverflow.com/questions/6721616/how-can-i-to-change-text

Inconsistency when setting TextView font size in code and in resources

假如想象 提交于 2019-11-29 20:23:27
The official documentation does not seem to answer this, or I can't figure it out. Element (nevermind the AlertDialog , it happens on any TextView as well): TextView tv = (TextView) dialog.findViewById(android.R.id.message); Inconsistency. Case A: tv.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14); // or tv.setTextSize(14); does the same Case B: tv.setTextSize(getResources().getDimension(R.dimen.text_size_small)); // TypedValue makes no difference either. where values/dimens.xml has it: <dimen name="text_size_small">14sp</dimen> Result: font size is not the same, and appears much bigger when

How Can I to Change Text Size in RemoteViews

﹥>﹥吖頭↗ 提交于 2019-11-29 13:56:13
问题 Under RemoteViewsService.RemoteViewsFactory public RemoteViews getViewAt(int position) { final int itemId = (position % 2 == 0 ? R.layout.light_widget_item : R.layout.dark_widget_item); RemoteViews rv = new RemoteViews(mContext.getPackageName(), itemId); rv.setTextViewText(R.id.widget_item, text); // rv.setTextSize(mPrefs.getTextsize().getValue()); return rv; } How can I change the text size programmatically? 回答1: How about the setFloat() method? rv.setFloat(R.id.widget_item, "setTextSize",

Dynamic Text size change according to tablet

房东的猫 提交于 2019-11-28 19:44:14
With all effort,I finally reached to the end of my first app in android. And thanks to all. But after coming to end, I realized one thing that my app text size is common in all tablet sizes. So I will re frame my question. Problem: I used my own custom text size in entire app. and some what satisfied with 7 inch tablet. But when I am looking the same thing in 8.9 inches and 10.1 inch tablet its containing lots of white spaces and text size are also relatively small. So is there some way that I can change the text size according to my tablet size??? It may look novice question but I am

How to set text size in WebView in android

被刻印的时光 ゝ 提交于 2019-11-28 04:44:58
I am using WebView to justify text. I want to know- Is it possible to set the text size in layout file? As I want different text size for different screen sizes. And also one problem is first background appears then after 2 second text display. Is it possible to display text immediately? Size of text is 7-8 lines . Code- public class Main extends Activity { WebView mWebView; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); mWebView = (WebView) findViewById(R.id.webview); String text = "<html><body>"+"<p align=\

What is the default text size on Android?

不打扰是莪最后的温柔 提交于 2019-11-28 02:56:10
I have a mixture of Buttons and an own View, where I set my text size using Paint.setTextSize(). I want the text size to look the same like the text on the Button. Now, I can of course set the text size of the button to e.g. 18sp, and use 18 in my view. But for a better integration, I simply would like to know, what text size is "normal" for buttons. From my test, it should be something like 12sp, but I have not found any documentation on this. Leaving the default sizes leaves way too small text on the view. Maybe I should use still another approach to this issue? Sonny This will return

Get the size of a text in TextView

假装没事ソ 提交于 2019-11-27 18:58:23
I have a problem placing a textView at specified center's x and y coordinates. Firstly, I tried to set the text in the textView, and to move the view with the width and the height of the view from this link . But it doesn't work, and I'd like to try something else. I'd like to know if there is a method to get the size which a specified text will take in my textView? I mean, I know the text and the textSize, how can I get the width and the height my textView will take? Something like the method (NSString)sizeWithFont; for those who know iPhone dev. Sherif elKhatib If your textview is called TV