cel*_*tis 6 android themes coding-style
我想将主题中的文本外观设置为TextAppearnance.Large.这是我在styles.xml中做的事情(我的应用程序指向我的清单中的这个主题)
<style name="myTheme" parent="android:Theme.NoTitleBar.Fullscreen">
<item name="android:textAppearance">@android:style/TextAppearance.Large</item>
</style>
Run Code Online (Sandbox Code Playgroud)
问题:我的文字仍然显示得很小.
问题(S):
首先,将属性声明为
<item name="android:textAppearance">?android:attr/textAppearanceLarge</item>
Run Code Online (Sandbox Code Playgroud)
但是,在主题中声明文本外观或文本颜色只会影响在任何地方绝对没有样式或属性的文本,包括系统定义的文本.如果你添加一个
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Medium Text" />
Run Code Online (Sandbox Code Playgroud)
即使没有android:textAppearance="?android:attr/textAppearanceMedium"Eclipse引入的行,它也会受到这个主题的影响,但按钮之类的东西永远不会.
ton*_*gil -1
主题和样式在您的环境中 sdk 实现的 theme.xml 和 styles.xml 文件中定义(不同的 android 版本或 sdk 级别有不同的文件)。
在计算机中搜索 theme.xml(例如,您可能会在 Windows 32 位计算机上的“program files/android”文件夹中找到它的多个实例)。
这篇文章解释了如何自定义这些属性。
您还可以通过修改TextView 标记属性在 xml 布局文件中设置显式大小属性:
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="15sp is the 'normal' size."
android:textSize="15sp"
/>
Run Code Online (Sandbox Code Playgroud)
这篇文章解释了如何直接在 xml 布局文件中自定义 Android 字体(包括 fontType、fontColor、shadow、bold、italic)。
| 归档时间: |
|
| 查看次数: |
22077 次 |
| 最近记录: |