我正在嘗試在全局級別設置文本大小,並且無法找到或找到執行此操作的方法。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