[英]Linear Layout margin added by default. How to avoid that? Android
[英]View text in Android layout that was previously black by default now suddenly grey by default. Cannot work out what's changed
我遇到了一个让我把头发拉了几天的问题,谷歌搜索在这里搜索并没有找到任何似乎遇到同样事情的人。 我在大学学习Java,但我最近才开始学习Android。 我现在在一所学校工作,并在业余时间建立一个基本的教育测验应用程序,在课堂上和孩子们一起玩,但我遇到了一些我不明白的布局行为。
当我开始使用这个应用程序时,文本总是黑色的,或者至少是这样的深灰色,我无法区分它们。 我布置的每个活动都有漂亮的黑暗文字。 我正在修改其中一个,以便在几天前在一些进度条上添加TextView标签,并注意到标签上的文字看起来比平常稍微偏淡,但因为字体太小而将其视为AA,并且所有之前添加的组件仍然很好而且很暗。 但是,当我继续布局另一个新的Activity之后,我添加的每个TextView的文本颜色都与之前的标签相同。 我可以手动将这些标签的颜色单独设置为我喜欢的任何颜色并且它们会发生变化,但我不明白为什么我必须为每个新活动中的每个新视图执行此操作,而预先存在的活动仍按预期工作。 我不明白他们为什么会有不同的违约行为。
我尝试在应用程序主题“AppTheme”中设置“@ color / black”,这是我之前从未接触到的,虽然这使得文本变黑,但它打破了禁用按钮,因为它们会在禁用时保持黑色而不是更改颜色,所以仍然看起来很活跃。 另外,无论如何,我宁愿了解什么是错误而不是克服它。
那么,任何人都可以告诉我为什么以下第一个布局中的TextView文本默认为中灰色,而第二个中的文本默认为黑色? 我看不出有什么区别,他们甚至有相同的嵌套布局结构,但它们呈现不同的颜色......
新的活动布局,呈现奇怪的灰色:
<?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>
实际上,奇怪的是,这个布局底部的按钮上的文字仍然是黑色/黑色。 虽然所有TextView都在中灰色(尽管旧活动中没有)。
哎呀,由于30K字符限制,没有空间发布下一个布局。 将单独添加作为新答案。 也许有人可以发现有什么不同。
哦,以防万一, 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>
和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>
直到问题发生之后,当我试图解决问题时,我才接触过这个问题。 那个父主题“Theme.AppCompat.Light.DarkActionBar”是通常的默认父级吗? 我不知道我怎么能改变它但它可能是苍白的默认文字颜色的来源?
如何找到标准主题提供的默认设置? (比如“Theme.AppCompat.Light.DarkActionBar”的primaryTextColor?)
如果可能的话,我真的很想了解这里发生了什么,所以我将来可以避免它。
检查AndroidMaifest.xml文件并查找android:theme=
行代码。 我看起来像这样:
<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>...........
您可以通过转到style.xml文件并添加android:textColorPrimary和android:textColorSecondary添加到主题中所需的颜色来更改此设置。 这将自动应用于您的整个应用程序。 希望这可以帮助。
较旧的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>
所有其他旧活动都变黑了,所以我不知道这里发生了什么。 请帮忙?
哦,以防万一, 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>
和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>
直到问题发生之后,当我试图解决问题时,我才接触过这个问题。 那个父主题“Theme.AppCompat.Light.DarkActionBar”是通常的默认父级吗? 我不知道我怎么能改变它但它可能是苍白的默认文字颜色的来源?
如何找到标准主题提供的默认设置? (比如“Theme.AppCompat.Light.DarkActionBar”的primaryTextColor?)
如果可能的话,我真的很想了解这里发生了什么,所以我将来可以避免它。
编辑:解决了
终于注意到所有黑暗的视图都有android:textAppearance="?android:attr/textAppearanceLarge"
设置。 这显然使文本颜色变暗,即使attr / textAppearanceMedium和attr / textAppearanceSmall也没有。 主要使用“大文本”插入按钮或复制并粘贴这些现有块,默认情况下看起来所有文本都是黑暗的。 使用“Plain TextView”而不是“Large Text”开始一个新活动,将Views插入树中,突然看起来默认颜色已经改变。 :/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.