text-size

Java Android Canvas.drawText(…) equally big in all screens

那年仲夏 提交于 2019-12-08 05:58:03
问题 I have drawn text with canvas.drawText(...) in my project and tested it against with different devices. However, the size of the text varies a lot from screen to screen. I have tried to multiply it with getResources().getDisplayMetrics().density but they are still slightly not the same size. Is there a way to get the text to have the same size on different devices? 回答1: hi you can look at this post , http://catchthecows.com/?p=72, i think it helps to you. @Override protected void

Java Android Canvas.drawText(…) equally big in all screens

▼魔方 西西 提交于 2019-12-08 04:02:28
I have drawn text with canvas.drawText(...) in my project and tested it against with different devices. However, the size of the text varies a lot from screen to screen. I have tried to multiply it with getResources().getDisplayMetrics().density but they are still slightly not the same size. Is there a way to get the text to have the same size on different devices? hi you can look at this post , http://catchthecows.com/?p=72 , i think it helps to you. @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); // save view size mViewWidth =

How to change the Menu text size

。_饼干妹妹 提交于 2019-12-07 03:36:02
问题 I had tried change the style like this: <item name="android:actionMenuTextAppearance">@style/MenuTextStyle</item> <stylename="MenuTextStyle"parent="@style/TextAppearance.AppCompat.Widget.ActionBar.Menu"> <item name="android:textColor">@android:color/white</item> <item name="android:textSize">16sp</item> </style> But it did work. sorry for my english. If you know it, tell me please. Thank you in advance! 回答1: In your application's base theme, add the following item: <item name="android

Android: How do I set the textsize for a layout?

吃可爱长大的小学妹 提交于 2019-12-06 18:42:57
问题 I am trying to set the textsize at a global level and cannot figure or find a way to do it. For example I have something like this: <?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"> <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id = "@+id/Table" android:layout_width="fill_parent" android:layout_height="fill_parent" android

Android: How do I set the textsize for a layout?

旧时模样 提交于 2019-12-05 01:25:55
I am trying to set the textsize at a global level and cannot figure or find a way to do it. For example I have something like this: <?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"> <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id = "@+id/Table" android:layout_width="fill_parent" android:layout_height="fill_parent" android:shrinkColumns="*" android:stretchColumns="*"> </TableLayout> </ScrollView> The TableRows and TextViews

iOS - Animating text size change in UILabel or UITextView?

≡放荡痞女 提交于 2019-12-04 12:06:06
问题 In an application showing chunks of text, I'm having the font size increase when the device is turned to a landscape orientation. I don't like how it does the whole animation and then suddenly jumps to the new size, so I'd like to animate the size change over the course of the rotation. I read somewhere that throwing this change in a UIView animation block doesn't work because the font property is not animatable, so what are my options for doing this? For my specific implementation I'm not

is there any-way to use SpannableString in TabLayout?

旧街凉风 提交于 2019-12-04 03:24:29
问题 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);

Inconsistency when setting TextView font size in code and in resources

左心房为你撑大大i 提交于 2019-12-03 18:25:42
问题 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

iOS - Animating text size change in UILabel or UITextView?

余生颓废 提交于 2019-12-03 06:56:02
In an application showing chunks of text, I'm having the font size increase when the device is turned to a landscape orientation. I don't like how it does the whole animation and then suddenly jumps to the new size, so I'd like to animate the size change over the course of the rotation. I read somewhere that throwing this change in a UIView animation block doesn't work because the font property is not animatable, so what are my options for doing this? For my specific implementation I'm not simply scaling the UILabel / UITextView as-is; The bounds of the box is increasing more (proportionally)

Is there a faster way to change accessibility (dynamic type) text size on iOS simulator?

时光毁灭记忆、已成空白 提交于 2019-12-02 03:18:46
问题 On my iPhone XS, I created a shortcut in the Control Center to quickly change the text size and test to make sure all the sizes work on my iPhone. However, I'm often in the simulator trying to test, and it's tedious to need to switch to the Settings app and go through multiple menus to switch the text size. Since the simulator has no Control Center, is there another way to more easily change the text size? 回答1: The best way to reach your goal depends on the Xcode version you're using. In