Android: One activity's text color won't adopt dark theme


Android: One activity's text color won't adopt dark theme



I changed the theme to dark in styles.xml:


<style name="AppTheme" parent="Theme.AppCompat">



and 2 of the 3 activities seem to have adjusted well:
enter image description hereenter image description here



But then the the other activity did not adjust well:
enter image description here



I am not sure why this is happening. Now this is a simplified version of my code that repeats the problem:


public class WorkoutActivity extends AppCompatActivity {

public static final String EXTRA_DAY = "blah";

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_workout);

Intent dayNumIntent = getIntent();
String dayExtra = dayNumIntent.getStringExtra(EXTRA_DAY);

LayoutParams linearLayoutParams = new LayoutParams(-1, -2, 1);
LayoutParams exercisePrevParams = new LayoutParams(0, -1, 4);

TextView topText = findViewById(R.id.dayText);
topText.setText(dayExtra);

LinearLayout mLinearLayout = findViewById(R.id.workout_layout);

LinearLayout statLabelLayout = new LinearLayout(getApplicationContext());
statLabelLayout.setOrientation(LinearLayout.HORIZONTAL);

statLabelLayout.addView(defaultTextView(getResources().getString(R.string.previous), 16), exercisePrevParams);
mLinearLayout.addView(statLabelLayout, linearLayoutParams);

}

private TextView defaultTextView (String text, int textSize){
TextView textView = new TextView(getApplicationContext());
textView.setText(text);
textView.setGravity(Gravity.CENTER);
textView.setTextSize(textSize);
return textView;
}

}









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

How to make file upload 'Required' in Contact Form 7?

Rothschild family

amazon EC2 - How to make wp-config.php to writable?