[英]View text in Android layout that was previously black by default now suddenly grey by default. Cannot work out what's changed
I've Encountered a problem that's had me pulling out my hair a couple of days, and Googling plus searching here hasn't turned up anyone that seems to have encountered the same thing. 我遇到了一个让我把头发拉了几天的问题,谷歌搜索在这里搜索并没有找到任何似乎遇到同样事情的人。 I learned Java at university but I'm just starting to learn Android recently.
我在大学学习Java,但我最近才开始学习Android。 I'm working at a school at the moment and have been building a basic educational quiz app in my spare time to play with kids in class, but I've run into some layout behaviour I just don't understand.
我现在在一所学校工作,并在业余时间建立一个基本的教育测验应用程序,在课堂上和孩子们一起玩,但我遇到了一些我不明白的布局行为。
When I started this app, text was always black, or at least such a dark grey I couldn't really tell the difference. 当我开始使用这个应用程序时,文本总是黑色的,或者至少是这样的深灰色,我无法区分它们。 Every Activity I laid out had nice, dark text.
我布置的每个活动都有漂亮的黑暗文字。 I was modifying one of these to add TextView labels on top of some progress bars a couple days ago, and noticed the text on the labels seemed a bit paler than usual, but dismissed it as AA since the font was so small, and all the previously-added components were still nice and dark.
我正在修改其中一个,以便在几天前在一些进度条上添加TextView标签,并注意到标签上的文字看起来比平常稍微偏淡,但因为字体太小而将其视为AA,并且所有之前添加的组件仍然很好而且很暗。 However, when I went on to layout another, new Activity after that, the text colour of every TextView I added was the same medium grey from the labels before.
但是,当我继续布局另一个新的Activity之后,我添加的每个TextView的文本颜色都与之前的标签相同。 I can manually set the colour of these labels individually to whatever I like and they change, but I don't see why I should have to do this for every new View in every new Activity while the pre-existing ones still work as expected.
我可以手动将这些标签的颜色单独设置为我喜欢的任何颜色并且它们会发生变化,但我不明白为什么我必须为每个新活动中的每个新视图执行此操作,而预先存在的活动仍按预期工作。 I don't understand why they're defaulting differently.
我不明白他们为什么会有不同的违约行为。
I tried setting "@color/black" in the app theme "AppTheme", which I previously had never touched, and while that made the text turn black, it broke disabling buttons, in that they would stay black instead of change colour when disabled, so still looked active. 我尝试在应用程序主题“AppTheme”中设置“@ color / black”,这是我之前从未接触到的,虽然这使得文本变黑,但它打破了禁用按钮,因为它们会在禁用时保持黑色而不是更改颜色,所以仍然看起来很活跃。 Plus, I'd rather understand what's gone wrong than kludge over it, anyway.
另外,无论如何,我宁愿了解什么是错误而不是克服它。
So, can anyone tell my why the TextView text in the first of the following layouts defaults to a sort of medium grey, while the text in the second defaults to black? 那么,任何人都可以告诉我为什么以下第一个布局中的TextView文本默认为中灰色,而第二个中的文本默认为黑色? I can't see what the difference is, and they even have the same nested layout structure, but they render in different colours...
我看不出有什么区别,他们甚至有相同的嵌套布局结构,但它们呈现不同的颜色......
New Activity layout, renders weirdly grey: 新的活动布局,呈现奇怪的灰色:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".QuestionResultsPageActivity">
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/activity_horizontal_margin">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/questionTitleTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/questionTitleTextViewTopMargin"
android:text="@string/questionTitleTextViewText"
android:textSize="@dimen/questionTitleTextViewTextSize"
android:textStyle="bold" />
<TextView
android:id="@+id/questionTextTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/questionTitleTextView"
android:layout_marginLeft="@dimen/controls_horizontal_margin"
android:layout_marginRight="@dimen/controls_horizontal_margin"
android:text="@string/questionTextTextViewText"
android:textSize="@dimen/questionTextTextViewTextSize" />
<TextView
android:id="@+id/answerTitleTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/questionTextTextView"
android:layout_marginTop="@dimen/answerTitleTextViewTopMargin"
android:text="@string/answerTitleTextViewText"
android:textSize="@dimen/answerTitleTextViewTextSize"
android:textStyle="bold" />
<TextView
android:id="@+id/answerLetterTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/answerTitleTextView"
android:layout_marginLeft="@dimen/controls_horizontal_margin"
android:layout_marginRight="@dimen/answerLabelSpacing"
android:text="@string/answerLetterTextViewText"
android:textSize="@dimen/answerLabelTextViewTextSize"
android:textStyle="bold" />
<TextView
android:id="@+id/answerTextTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/answerTitleTextView"
android:layout_toRightOf="@id/answerLetterTextView"
android:text="@string/answerTextTextViewText"
android:textSize="@dimen/answerTextTextViewTextSize" />
<TextView
android:id="@+id/resultsTitleTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/answerTextTextView"
android:layout_marginTop="@dimen/resultsTitleTextViewTopMargin"
android:text="@string/resultsTitleTextViewText"
android:textSize="@dimen/resultsTitleTextViewTextSize"
android:textStyle="bold" />
<LinearLayout
android:id="@+id/resultsBlockLinearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/resultsTitleTextView"
android:baselineAligned="false"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/questionResultTeamNamesLinearLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="@+id/questionResultTeamNameHeadingTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Team"
android:textSize="@dimen/teamResultsNameTextSize"
android:textStyle="bold" />
<TextView
android:id="@+id/questionResultTeamNameTextView_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Team 1"
android:textSize="@dimen/teamResultsNameTextSize" />
<TextView
android:id="@+id/questionResultTeamNameTextView_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Team 2"
android:textSize="@dimen/teamResultsNameTextSize" />
<TextView
android:id="@+id/questionResultTeamNameTextView_3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Team 3"
android:textSize="@dimen/teamResultsNameTextSize" />
<TextView
android:id="@+id/questionResultTeamNameTextView_4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Team 4"
android:textSize="@dimen/teamResultsNameTextSize" />
<TextView
android:id="@+id/questionResultTeamNameTextView_5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Team 5"
android:textSize="@dimen/teamResultsNameTextSize" />
<TextView
android:id="@+id/questionResultTeamNameTextView_6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Team 6"
android:textSize="@dimen/teamResultsNameTextSize" />
<TextView
android:id="@+id/questionResultTeamNameTextView_7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Team 7"
android:textSize="@dimen/teamResultsNameTextSize" />
<TextView
android:id="@+id/questionResultTeamNameTextView_8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Team 8"
android:textSize="@dimen/teamResultsNameTextSize" />
<TextView
android:id="@+id/questionResultTeamNameTextView_9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Team 9"
android:textSize="@dimen/teamResultsNameTextSize" />
</LinearLayout>
<LinearLayout
android:id="@+id/questionResultTeamAnswerLetterLinearLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="@+id/questionResultTeamNameTextView_9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="\?"
android:textSize="@dimen/teamResultsNameTextSize"
android:textStyle="bold" />
<TextView
android:id="@+id/questionResultTeamNameTextView_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="A"
android:textSize="@dimen/teamResultsNameTextSize" />
<TextView
android:id="@+id/questionResultTeamNameTextView_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="A"
android:textSize="@dimen/teamResultsNameTextSize" />
<TextView
android:id="@+id/questionResultTeamNameTextView_3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="A"
android:textSize="@dimen/teamResultsNameTextSize" />
<TextView
android:id="@+id/questionResultTeamNameTextView_4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="A"
android:textSize="@dimen/teamResultsNameTextSize" />
<TextView
android:id="@+id/questionResultTeamNameTextView_5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="A"
android:textSize="@dimen/teamResultsNameTextSize" />
<TextView
android:id="@+id/questionResultTeamNameTextView_6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="A"
android:textSize="@dimen/teamResultsNameTextSize" />
<TextView
android:id="@+id/questionResultTeamNameTextView_7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="A"
android:textSize="@dimen/teamResultsNameTextSize" />
<TextView
android:id="@+id/questionResultTeamNameTextView_8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="A"
android:textSize="@dimen/teamResultsNameTextSize" />
<TextView
android:id="@+id/questionResultTeamNameTextView_9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="A"
android:textSize="@dimen/teamResultsNameTextSize" />
</LinearLayout>
<LinearLayout
android:id="@+id/questionResultTeamTimesLinearLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="@+id/questionResultTeamTimeHeadingTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Time"
android:textSize="@dimen/teamResultsTimeTextSize"
android:textStyle="bold" />
<TextView
android:id="@+id/questionResultTeamTimeTextView_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="123 + 27 = 150"
android:textSize="@dimen/teamResultsTimeTextSize" />
<TextView
android:id="@+id/questionResultTeamTimeTextView_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="123 + 27 = 150"
android:textSize="@dimen/teamResultsTimeTextSize" />
<TextView
android:id="@+id/questionResultTeamTimeTextView_3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="123 + 27 = 150"
android:textSize="@dimen/teamResultsTimeTextSize" />
<TextView
android:id="@+id/questionResultTeamTimeTextView_4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="123 + 27 = 150"
android:textSize="@dimen/teamResultsTimeTextSize" />
<TextView
android:id="@+id/questionResultTeamTimeTextView_5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="123 + 27 = 150"
android:textSize="@dimen/teamResultsTimeTextSize" />
<TextView
android:id="@+id/questionResultTeamTimeTextView_6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="123 + 27 = 150"
android:textSize="@dimen/teamResultsTimeTextSize" />
<TextView
android:id="@+id/questionResultTeamTimeTextView_7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="123 + 27 = 150"
android:textSize="@dimen/teamResultsTimeTextSize" />
<TextView
android:id="@+id/questionResultTeamTimeTextView_8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="123 + 27 = 150"
android:textSize="@dimen/teamResultsTimeTextSize" />
<TextView
android:id="@+id/questionResultTeamTimeTextView_9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="123 + 27 = 150"
android:textSize="@dimen/teamResultsTimeTextSize" />
</LinearLayout>
<LinearLayout
android:id="@+id/questionResultTeamScoresLinearLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="@+id/questionResultTeamScoreHeadingTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Score"
android:textSize="@dimen/teamResultsScoreTextSize"
android:textStyle="bold" />
<TextView
android:id="@+id/questionResultTeamScoreTextView_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="10 + 1 = 11"
android:textSize="@dimen/teamResultsScoreTextSize" />
<TextView
android:id="@+id/questionResultTeamScoreTextView_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="10 + 1 = 11"
android:textSize="@dimen/teamResultsScoreTextSize" />
<TextView
android:id="@+id/questionResultTeamScoreTextView_3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="10 + 1 = 11"
android:textSize="@dimen/teamResultsScoreTextSize" />
<TextView
android:id="@+id/questionResultTeamScoreTextView_4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="10 + 1 = 11"
android:textSize="@dimen/teamResultsScoreTextSize" />
<TextView
android:id="@+id/questionResultTeamScoreTextView_5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="10 + 1 = 11"
android:textSize="@dimen/teamResultsScoreTextSize" />
<TextView
android:id="@+id/questionResultTeamScoreTextView_6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="10 + 1 = 11"
android:textSize="@dimen/teamResultsScoreTextSize" />
<TextView
android:id="@+id/questionResultTeamScoreTextView_7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="10 + 1 = 11"
android:textSize="@dimen/teamResultsScoreTextSize" />
<TextView
android:id="@+id/questionResultTeamScoreTextView_8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="10 + 1 = 11"
android:textSize="@dimen/teamResultsScoreTextSize" />
<TextView
android:id="@+id/questionResultTeamScoreTextView_9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="10 + 1 = 11"
android:textSize="@dimen/teamResultsScoreTextSize" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</ScrollView>
<Button
android:id="@+id/questionResultOKButton"
android:layout_width="@dimen/okButtonWidth"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="@dimen/activity_horizontal_margin"
android:onClick="askNextQuestion"
android:text="@string/okButtonLabelText"
android:textSize="@dimen/okButtonLabelTextSize" />
</RelativeLayout>
Actually, curiously, the text on the Button at the bottom of this layout is still dark/black. 实际上,奇怪的是,这个布局底部的按钮上的文字仍然是黑色/黑色。 All TextViews are in it are mid-grey though (even though ones in older activities aren't).
虽然所有TextView都在中灰色(尽管旧活动中没有)。
Whoops, no room in post for next layout due to 30K character limit. 哎呀,由于30K字符限制,没有空间发布下一个布局。 Will add separately as new answer.
将单独添加作为新答案。 Maybe someone can spot what's different.
也许有人可以发现有什么不同。
Oh, and just in case, AndroidManifest.xml : 哦,以防万一, AndroidManifest.xml :
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="//REDACTED">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
//ALL DARK, NO PROBS
<activity
android:name=".StartPageActivity"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
//ALL DARK, NO PROBS
<activity
android:name=".AskQuestionActivity"
android:screenOrientation="portrait">
</activity>
//ALL DARK, NO PROBS
<activity
android:name=".TeamEntryActivity"
android:screenOrientation="portrait">
</activity>
//ALL DARK, NO PROBS
<activity
android:name=".AnswerEntryActivity"
android:screenOrientation="portrait">
</activity>
//SOME GREY IN RECENT EDITS (in the ProgressBar label TextViews)
<activity android:name=".GameResultsPageActivity">
android:screenOrientation="portrait">
</activity>
//ALL GREY, WTF?!
<activity android:name=".QuestionResultsPageActivity">
android:screenOrientation="portrait">
</activity>
</application>
</manifest>
and styles.xml : 和styles.xml :
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
</resources>
I hadn't touched this until after the problem occurred, when I was trying to fix things. 直到问题发生之后,当我试图解决问题时,我才接触过这个问题。 Is that parent theme "Theme.AppCompat.Light.DarkActionBar" the usual default parent?
那个父主题“Theme.AppCompat.Light.DarkActionBar”是通常的默认父级吗? I don't know how I could have changed it but could it be the source of the pale default text colour?
我不知道我怎么能改变它但它可能是苍白的默认文字颜色的来源?
How can I find the default settings provided by the standard themes? 如何找到标准主题提供的默认设置? (Like "Theme.AppCompat.Light.DarkActionBar"'s primaryTextColor?)
(比如“Theme.AppCompat.Light.DarkActionBar”的primaryTextColor?)
I would really like to understand what has happened here if possible, so I can avoid it in future. 如果可能的话,我真的很想了解这里发生了什么,所以我将来可以避免它。
check you AndroidMaifest.xml file and look for the android:theme=
line code. 检查AndroidMaifest.xml文件并查找
android:theme=
行代码。 Mine looks like this: 我看起来像这样:
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/Theme.AppCompat.Light.NoActionBar">
<activity android:name=".SplashScreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>...........
You can change this by going to your style.xml file and adding addding android:textColorPrimary andr android:textColorSecondary to your desired colors inside of your theme. 您可以通过转到style.xml文件并添加android:textColorPrimary和android:textColorSecondary添加到主题中所需的颜色来更改此设置。 That will be automatically applied to your whole application.
这将自动应用于您的整个应用程序。 Hope this helps.
希望这可以帮助。
And older Activity's layout, renders nicely dark except the TextViews over ProgressBars: (didn't fit in original question...) 较旧的Activity的布局,除了ProgressBars上的TextViews外,呈现出很暗的颜色:(不适合原始问题......)
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".GameResultsPageActivity">
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginBottom="@dimen/activity_horizontal_margin">
<RelativeLayout
android:id="@+id/resultsPageLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/gameOverLabel"
android:text="@string/gameOverLabelText"
android:textSize="@dimen/gameOverLabelTextSize"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textStyle="bold"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:layout_centerHorizontal="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"/>
<TextView
android:id="@+id/questionsAnsweredLabel"
android:text="@string/questionsAnsweredLabelText"
android:textSize="@dimen/questionAnsweredLabelTextSize"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/gameOverLabel"
android:layout_alignParentLeft="true"
android:layout_marginLeft="@dimen/controls_horizontal_margin"/>
<TextView
android:id="@+id/questionsAnsweredTextView"
android:text="\?"
android:textSize="@dimen/questionAnsweredLabelTextSize"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/gameOverLabel"
android:layout_alignParentRight="true"
android:layout_marginRight="@dimen/controls_horizontal_margin"/>
<TextView
android:id="@+id/finalScoresLabel"
android:text="@string/finalScoresLabelText"
android:textSize="@dimen/finalScoresLabelTextSize"
android:textStyle="bold"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/questionsAnsweredLabel"
android:layout_marginLeft="@dimen/controls_horizontal_margin"
android:layout_marginTop="@dimen/question_answer_vertical_spacing"/>
<RelativeLayout
android:id="@+id/team1ScoreLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/finalScoresLabel">
<TextView
android:id="@+id/teamNameLabel_1"
android:text="Large Text"
android:textSize="@dimen/finalScoresListTextSize"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="@dimen/controls_horizontal_margin"/>
<TextView
android:id="@+id/teamScoreLabel_1"
android:text="X"
android:textStyle="bold"
android:textSize="@dimen/finalScoresListTextSize"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="@dimen/controls_horizontal_margin"/>
<ProgressBar
android:id="@+id/team1ScoreProgressBar"
style="@android:style/Widget.ProgressBar.Horizontal"
android:progressDrawable="@drawable/gold_progress"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_toRightOf="@id/teamNameLabel_1"
android:layout_toLeftOf="@id/teamScoreLabel_1"
android:layout_marginLeft="@dimen/resultsPageProgressLRMargins"
android:layout_marginRight="@dimen/resultsPageProgressLRMargins"
android:max="100"
android:progress="90" />
<TextView
android:id="@+id/team1ScorePercentagetextView"
android:text="100%"
android:textStyle="bold"
android:textSize="@dimen/scorePercentageTextSize"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@id/team1ScoreProgressBar"
android:layout_alignBottom="@id/team1ScoreProgressBar"
android:layout_alignLeft="@id/team1ScoreProgressBar"
android:layout_alignRight="@id/team1ScoreProgressBar"
android:gravity="center"/>
<ProgressBar
android:id="@+id/team1TimeProgressBar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_toRightOf="@id/teamNameLabel_1"
android:layout_toLeftOf="@id/teamScoreLabel_1"
android:layout_marginLeft="@dimen/resultsPageProgressLRMargins"
android:layout_marginRight="@dimen/resultsPageProgressLRMargins"
android:layout_below="@id/team1ScoreProgressBar"
android:max="100"
android:progress="80" />
<TextView
android:id="@+id/team1TimetextView"
android:text="123s"
android:textStyle="bold"
android:textSize="@dimen/timeLabelTextSize"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@id/team1TimeProgressBar"
android:layout_alignBottom="@id/team1TimeProgressBar"
android:layout_alignLeft="@id/team1TimeProgressBar"
android:layout_alignRight="@id/team1TimeProgressBar"
android:gravity="center"/>
</RelativeLayout>
//REPEAT NESTED LAYOUTS ABOVE EIGHT MORE TIMES FOR TEAMS 2-9
//EDITED OUT TO FIT IN ANSWER CHARACTER LIMIT
<Button
android:id="@+id/closeResultsButton"
android:onClick="returnToStartGameActivity"
android:text="@string/okButtonLabelText"
android:textSize="@dimen/okButtonLabelTextSize"
android:textAllCaps="false"
android:layout_marginBottom="@dimen/controls_vertical_spacing"
android:layout_width="@dimen/okButtonWidth"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_below="@id/team9ScoreLayout"/>
</RelativeLayout>
</ScrollView>
</RelativeLayout>
All the other old Activities render dark, so I have no idea what's going on here. 所有其他旧活动都变黑了,所以我不知道这里发生了什么。 Please help?
请帮忙?
Oh, and just in case, AndroidManifest.xml : 哦,以防万一, AndroidManifest.xml :
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="//REDACTED">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
//ALL DARK, NO PROBS
<activity
android:name=".StartPageActivity"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
//ALL DARK, NO PROBS
<activity
android:name=".AskQuestionActivity"
android:screenOrientation="portrait">
</activity>
//ALL DARK, NO PROBS
<activity
android:name=".TeamEntryActivity"
android:screenOrientation="portrait">
</activity>
//ALL DARK, NO PROBS
<activity
android:name=".AnswerEntryActivity"
android:screenOrientation="portrait">
</activity>
//SOME GREY IN RECENT EDITS (in the ProgressBar label TextViews)
<activity android:name=".GameResultsPageActivity">
android:screenOrientation="portrait">
</activity>
//ALL GREY, WTF?!
<activity android:name=".QuestionResultsPageActivity">
android:screenOrientation="portrait">
</activity>
</application>
</manifest>
and styles.xml : 和styles.xml :
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
</resources>
I hadn't touched this until after the problem occurred, when I was trying to fix things. 直到问题发生之后,当我试图解决问题时,我才接触过这个问题。 Is that parent theme "Theme.AppCompat.Light.DarkActionBar" the usual default parent?
那个父主题“Theme.AppCompat.Light.DarkActionBar”是通常的默认父级吗? I don't know how I could have changed it but could it be the source of the pale default text colour?
我不知道我怎么能改变它但它可能是苍白的默认文字颜色的来源?
How can I find the default settings provided by the standard themes? 如何找到标准主题提供的默认设置? (Like "Theme.AppCompat.Light.DarkActionBar"'s primaryTextColor?)
(比如“Theme.AppCompat.Light.DarkActionBar”的primaryTextColor?)
I would really like to understand what has happened here if possible, so I can avoid it in future. 如果可能的话,我真的很想了解这里发生了什么,所以我将来可以避免它。
Edit: Solved 编辑:解决了
Finally noticed all the dark Views had android:textAppearance="?android:attr/textAppearanceLarge"
set. 终于注意到所有黑暗的视图都有
android:textAppearance="?android:attr/textAppearanceLarge"
设置。 Which apparently darkens the text colour too, even though attr/textAppearanceMedium and attr/textAppearanceSmall don't. 这显然使文本颜色变暗,即使attr / textAppearanceMedium和attr / textAppearanceSmall也没有。 Use mostly the "Large Text" insertion button or copy and paste these existing blocks enough and it looks like all text is dark by default.
主要使用“大文本”插入按钮或复制并粘贴这些现有块,默认情况下看起来所有文本都是黑暗的。 Start a new activity using the "Plain TextView" instead of "Large Text" to insert Views into the tree and suddenly it seems like the default colour has changed.
使用“Plain TextView”而不是“Large Text”开始一个新活动,将Views插入树中,突然看起来默认颜色已经改变。 :/
:/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.