Change Edittextpreference Dialog Input Text Color
I am able to change the title and summary color of my edit text preference. When you click into it I have the background dark and the buttons white. I still need to figure out ho
Solution 1:
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/prompt_password"
android:imeActionId="6"
android:textColor="@color/white"
android:textColorHint="@color/white"
android:imeActionLabel="@string/action_sign_in_short"
android:imeOptions="actionUnspecified"
android:inputType="textPassword"
android:maxLines="1"
android:singleLine="true" />
</android.support.design.widget.TextInputLayout>
Solution 2:
Try this:
<stylename="JayPreferenceThemeDialog"parent="Theme.AppCompat.Light.Dialog"><itemname="colorAccent">@color/colorAccent</item> //line color
<itemname="android:colorBackground">@color/THEME_LIGHTER_BACKGROUND</item><itemname="android:textColor">@android:color/background_light</item><itemname="android:textColorSecondary">@android:color/background_light</item></style>
Solution 3:
From the link Zealous shared: Android Theming Preference Dialog
@OverrideprotectedvoidshowDialog(Bundle state) {
super.showDialog(state);
TypefacecustomFont= FontCache.getTypeface("UnderwoodChampionRegular.ttf", GameActivity.commandReceiver.activity_settings);
finalResourcesres= getContext().getResources();
finalWindowwindow= getDialog().getWindow();
// TitlefinalinttitleId= res.getIdentifier("alertTitle", "id", "android");
finalViewtitle= window.findViewById(titleId);
if (title != null) {
((TextView) title).setTextColor(ContextCompat.getColor(MyCommandReceiver.context_settings, R.color.THEME_LIGHT_TEXT));
((TextView) title).setTypeface(customFont);
}
// Title dividerfinalinttitleDividerId= res.getIdentifier("titleDivider", "id", "android");
finalViewtitleDivider= window.findViewById(titleDividerId);
if (titleDivider != null) {
titleDivider.setBackgroundColor(ContextCompat.getColor(MyCommandReceiver.context_settings, R.color.THEME_LIGHT_TEXT));
}
// EditTextfinalVieweditText= window.findViewById(android.R.id.edit);
if (editText != null) {
((EditText) editText).setTextColor(ContextCompat.getColor(MyCommandReceiver.context_settings, R.color.THEME_LIGHT_TEXT));
((EditText) editText).setTypeface(customFont);
}
//OK buttonfinalViewokButton= window.findViewById(android.R.id.button1);
if (okButton != null) {
((Button) okButton).setTextColor(ContextCompat.getColor(MyCommandReceiver.context_settings, R.color.THEME_LIGHT_TEXT));
((Button) okButton).setTypeface(customFont);
}
//Cancel buttonfinalViewcancelButton= window.findViewById(android.R.id.button2);
if (cancelButton != null) {
((Button) cancelButton).setTextColor(ContextCompat.getColor(MyCommandReceiver.context_settings, R.color.THEME_LIGHT_TEXT));
((Button) cancelButton).setTypeface(customFont);
}
}
Post a Comment for "Change Edittextpreference Dialog Input Text Color"