change appcompat dialog title background to full width? - android

I want to change title color background(green) to full width.
<style name="AppCompatAlertDialogStyle" parent="Theme.AppCompat.Light.Dialog.Alert">
<item name="colorAccent">#000000</item>
<item name="android:textColorPrimary">#5c5c5c</item>
<item name="android:background">#fbdd9d</item>
<item name="android:windowTitleStyle">#style/TitleDialogTextStyle</item>
</style>
<style name="TitleDialogTextStyle" parent="Base.DialogWindowTitle.AppCompat">
<item name="android:textColor">#ffffff</item>
<item name="android:background">#color/green</item>
</style>
Please find attached snap. I want green color to full width.

I made a lot of tries, I never succeded to change the color defining a custom
android:windowTitleStyle or a android:windowTitleBackgroundStyle.
It only works using the following trick, add to your custom dialog style :
<item name="android:topDark">#color/your_color</item>
And the title background will be colored as you want.

Related

Change EditText long click menu text color

For some reason the menu that comes up on long click (for copy/paste/cut/etc...) in my EditText have white text color on a white background so it's unreadable.
I searched quite a lot on this forum but haven't found answer that would have worked so far, I have also tried adding a custom popup style for the base theme as well as for the EditText style with colorAccent, color and textColor changed, like this:
<style name="Base.AppTheme" parent="Theme.AppCompat.NoActionBar">
<!-- Tried all 3 separately -->
<item name="android:popupMenuStyle">#style/CustomPopup</item>
<item name="popupMenuStyle">#style/CustomPopup</item>
<item name="popupTheme">#style/CustomPopup</item>
</style>
<style name="Style.Input.EditText" parent="Widget.AppCompat.EditText">
<!-- Tried all 3 separately -->
<item name="android:popupMenuStyle">#style/CustomPopup</item>
<item name="popupMenuStyle">#style/CustomPopup</item>
<item name="popupTheme">#style/CustomPopup</item>
</style>
<style name="CustomPopup" parent="Widget.AppCompat.Light.PopupMenu">
<item name="android:colorAccent">#000000</item>
<item name="android:color">#000000</item>
<item name="android:textColor">#000000</item>
</style>
Unfortunately it did not work.
Does anyone know of a way to customise this menu, the text color in particular?
Check the theme style
<item name="android:background">#FFFFFF</item>
It's highly likely that you have it set to WHITE and the text is already being set to WHITE. I would comment out this line where you're setting the background color and see if you can't figure it out from there. This was my issue.

Kotlin Android - Change app start up background color

As title, I need to change my app start up background color. Actually, is full white, and need to be #202030
I tried with
<item name="android:windowBackgroundColor">#202030</item>
in my style.xml but it's full black, no matters what color I set to this attribute.
Also, I can't use directly
<item name="android:backgroundColor>#202030</item>
because I will get also Cut/Copy/Paste background menu with this color and text in black
This is my style:
<style name="AppTheme" parent="Theme.AppCompat">
<!-- Customize your theme here. -->
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="android:windowBackground">#202030</item>
<item name="colorAccent">#1E88E5</item>
<item name="android:navigationBarColor">#202030</item>
<item name="android:statusBarColor">#1d1d30</item>
<item name="android:textColorPrimary">#E0E0E0</item>
<item name="android:timePickerStyle">#style/TimePickerStyleLight</item>
<item name="android:fontFamily">#font/product_sans_regular</item>
<item name="android:textColor">#E0E0E0</item>
<item name="android:colorControlHighlight">#3399ff</item>
<item name="android:colorControlActivated">#3399ff</item>
<item name="alertDialogStyle">#style/AppCompatAlertDialogStyle</item>
<item name="android:textColorHint">#BDBDBD</item>
</style>
In your colors.xml
add
<color name="splash_color">#202030</color>
then in style.xml add splash_color to your theme.
<item name="android:windowBackground">#color/splash_color</item>
to create your custom color in Android Studio, you can add you color in past Values->Color->then put you line color that you want.
step-one
Then, you can go in you xml background color and add in your layout, just as simple
step-two
i hope that i can help, if this is not your aswer, comment here and explain more what you want.

Android - Change text colour of the bottom button bar

I'm modifying downloads (for 4.3 Jellybean) and I can't change the colour of the text on the bottom button from black to white. Is it possible to change the text colour without giving the button its own style by adding an item in the app theme? Here is my Styles.xml:
<style name="DownloadListTheme" parent="#android:style/Theme.DeviceDefault.Light.DialogWhenLarge">
<item name="android:textAlignment">viewStart</item>
<item name="android:layoutDirection">locale</item>
<item name="android:actionBarStyle">#android:style/Widget.DeviceDefault.Light.ActionBar.Solid.Inverse</item>
<item name="com.sonyericsson.uxp:extendedLookAndFeel">true</item>
<item name="android:textColor">#android:color/white</item>
</style>
Yes, you can accomplish this pretty easily, just override your theme in styles.xml like this:
<style name="MyButtonStyle"
parent="#android:style/Theme.DeviceDefault.Light.DialogWhenLarge">
<item name="android:textColor">#android:color/white</item>
</style>
For more information, see the documentation.

how to change the text size in "showcaseview" library

Is there a way to change text and tile size in showcaseview?
I cant find in the code where the text size is set.
Thanks,
Ilan
You can use a theme, which takes styles for title text appearance and detail text appearance. These can be used to change the text size.
The sample styles.xml shows how to customise these attributes. So to change the text size of the title, you'd add a textSize attribute to the CustomTitle.
it's very simple, just need to add into style file as i have mentioned below:
<style name="CustomShowcaseTheme2" parent="ShowcaseView">
<item name="sv_backgroundColor">#90000000</item>
<item name="sv_showcaseColor">#25467A</item>
<item name="sv_buttonText">Close</item>
<item name="sv_titleTextAppearance">#style/CustomTitle2</item>
<item name="sv_detailTextAppearance">#style/CustomText2</item>
</style>
<style name="CustomTitle2" parent="TextAppearance.ShowcaseView.Title.Light">
<item name="android:textColor">#color/colorPrimary</item>
<item name="android:textSize">26sp</item>
</style>
<style name="CustomText2" parent="TextAppearance.ShowcaseView.Detail.Light">
<item name="android:textColor">#color/white</item>
<item name="android:textSize">20sp</item>
</style>

Attribute to change the color of the tab indicator

This problem is really driving me crazy.
I am using the viewpager indicator without any trouble, but I would like to change something on the final result:
I would like to change the color of the line from blue to green; obviously I would like to keep the same line color when a tab is selected. This is my style file:
<resources>
<style name="collection_field">
<item name="android:layout_width">0dp</item>
<item name="android:layout_height">wrap_content</item>
</style>
<style name="collection_header" parent="collection_field">
<item name="android:textStyle">bold</item>
</style>
<style name="CollectionTabPageIndicator" parent="Widget.TabPageIndicator">
<item name="android:textColor">#android:color/black</item>
</style>
<style name="Theme.Collection" parent="#android:style/Theme.Light.NoTitleBar">
<item name="vpiTabPageIndicatorStyle">#style/CollectionTabPageIndicator</item>
</style>
What attribute am I supposed to use to make this happens? Thanks for your replies.
You'll need to create your own tab indicators then apply them using the android:background attribute in your CollectionTabPageIndicator style.
<style name="CollectionTabPageIndicator" parent="Widget.TabPageIndicator">
<item name="android:textColor">#android:color/black</item>
<item name="android:background">#drawable/your_tab_indicator</item>
</style>
The easiest way to create your own green indicators is to use the Action Bar Style Generator.
Once there, turn on the Tab hairline style and apply your Tab indicator color. Then download the zip, copy over all of your tab indicator resources into the appropriate drawable folders, and finally add it your style.
For reference, here's the default blue indicator res/drawable/vpi__tab_indicator

Categories

Resources