我正在尝试在全局级别设置文本大小,并且无法找到或找到执行此操作的方法。Android:我如何设置布局的文本大小?
例如,我有这样的事情:
<?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>
的TableRows和TextViews本身产生动态地取决于用户输入。
问题是我想基于资源文件全局设置基本textSize,而不必去和触摸一堆代码。有没有办法告诉应用程序,“嘿应用程序,用它作为所有textViews的基本文本大小?”
或者换句话说,在HTML中,我可以在body,div和table级别设置字体大小。在布局(LinearLayout,TableLayout,ScrollView等)级别上可以做类似的事情吗?
感谢该诀窍。我搜索了几个小时并找不到它。再次感谢。 –
甜蜜,乐意帮忙! –
另外值得一提的是,“你应该更喜欢使用sp(scale-independent pixel)来定义文本大小。sp比例因子取决于用户设置,系统按照dp的尺寸调整大小。” http://developer.android.com/guide/practices/screens_support.html#screen-independence – scottyab