【发布时间】:2013-06-04 08:08:38
【问题描述】:
这是 XML:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/modal_list_row"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="7.5dp"
android:orientation="vertical" >
<TextView
android:id="@+id/title_text_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:gravity="center"
android:text="@string/alert_title_small"
android:textColor="@color/alert_dialog_text_color"
android:textSize="@dimen/alert_dialog_title_font_size"
android:textStyle="bold" />
</RelativeLayout>
虽然图形布局显示粗体文本,但在设备上却不是。是设备还是什么?
更新:
对于那些不断要求完整 XML 的人,这里更新了。一个简单的相对布局。这是Java代码:
this.titleTextView.setText(this.modalListState.title);
要考虑的事情:可能是由于设备字体造成的吗?有人要确认 Galaxy S3 吗?会不会是活动风格?这是用于整个应用程序的一个:
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
<style name="TransparentActivity" >
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:colorBackgroundCacheHint">@null</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowAnimationStyle">@android:style/Animation</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowFullscreen">false</item>
</style>
TransparentActivity 样式用于相关活动。
【问题讨论】:
-
您确定没有在任何地方更改java代码中的
TextView属性吗? -
我确定。只在代码中引用它来设置它的文本。
-
有什么特别的设备吗?
-
能否请您粘贴完整的 xml ,以及 alert_title_small,alert_dialog_text_color,alert_dialog_title_font_size 的值是什么以获得更多信息?
-
你可以参考这个链接。 stackoverflow.com/questions/6200533/…