is it possible to format a textview for a widget so that it looks like the text below the apps.
like in this screenshot:
i am looking for the exact textcolor, the exact dropshadow and the rounded background.
When in doubt, check with the source, which shows that Android is using a custom TextView to implement the bubbled background around the text.
It appears that the text itself is styled using styles in the launcher app:
<style name="WorkspaceIcon">
<item name="android:textSize">13dip</item>
<item name="android:singleLine">true</item>
<item name="android:ellipsize">marquee</item>
<item name="android:shadowColor">#FF000000</item>
<item name="android:shadowRadius">2.0</item>
<item name="android:textColor">#FFF</item>
<item name="android:gravity">center_horizontal</item>
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">match_parent</item>
<item name="android:background">#drawable/shortcut_selector</item>
<item name="android:paddingLeft">5dip</item>
<item name="android:paddingRight">5dip</item>
</style>
<style name="WorkspaceIcon.Portrait">
<item name="android:drawablePadding">5dip</item>
<item name="android:paddingTop">4dip</item>
<item name="android:layout_marginLeft">3dip</item>
<item name="android:layout_marginRight">3dip</item>
<item name="android:layout_marginTop">13dip</item>
<item name="android:layout_marginBottom">8dip</item>
</style>
<style name="WorkspaceIcon.Landscape">
<item name="android:drawablePadding">3dip</item>
<item name="android:paddingTop">2dip</item>
<item name="android:layout_marginLeft">10dip</item>
<item name="android:layout_marginRight">10dip</item>
</style>
Those styles are called from the launcher's layouts as appropriate.
Related
I have attached the screenshot showing what I want to achieve. I want to achieve just one background for my popup menu. Now as you can see on the picture below my menu there is a second background? I want toi stay this one below (darker one) with rounded corners. How to fix this?
I am adding my style.xml
<style name="objectsmeasure_dark" parent="Theme.MaterialComponents.NoActionBar">
<item name="colorPrimary">#color/a212121</item>
<item name="colorPrimaryDark">#android:color/black</item>
<item name="colorAccent">#color/colorAccent</item>
<item name="android:alertDialogTheme">#style/alert_dialog_dark</item>
<item name="android:windowBackground">#color/colorWindowBackgroundNight</item>
<item name="colorBg">#color/colorWindowBackgroundNight</item>
<item name="colorBottomNavigationViewBg">#color/bottom_nav_view_bg_night</item>
<item name="colorBottomNavigationViewItem">#color/bottom_nav_view_item_night</item>
<item name="android:popupMenuStyle">#style/popup_menu_dark</item>
<item name="popupMenuStyle">#style/popup_menu_dark</item>
<item name="myBackgroundColor">#color/colorGrey</item>
<item name="myEtBackgroundColor">#color/BF606060</item>
<item name="myCardBackground">#color/a212121</item>
<item name="myTextColor">#android:color/white</item>
<item name="myTintColor">#android:color/white</item>
<item name="myButtonColor">#color/colorButton</item>
<item name="myHintTextColor">#color/B3FFFFFF</item>
<item name="android:navigationBarColor">#android:color/black</item>
<item name="dialogTheme">#style/dialog_dark</item>
<item name="android:dialogTheme">#style/dialog_dark</item>
<item name="android:windowContentTransitions">true</item>
<item name="currentTheme">#style/objectsmeasure_dark</item>
</style>
<style name="popup_menu_dark" parent="Widget.AppCompat.PopupMenu">
<item name="android:popupBackground">#color/dark</item>
</style>
<style name="alert_dialog_dark" parent="Theme.MaterialComponents.Dialog.Alert">
<item name="colorPrimary">#color/colorButton</item>
<item name="android:textColor">#android:color/white</item>
<item name="android:textColorPrimary">#android:color/white</item>
<item name="android:background">#color/dark</item>
<item name="background">#color/dark</item>
<item name="buttonBarPositiveButtonStyle">#style/alert_dialog_button_positive</item>
<item name="buttonBarNegativeButtonStyle">#style/alert_dialog_button_negative</item>
</style>
<style name="dialog_dark" parent="Theme.MaterialComponents.Dialog">
<item name="colorPrimary">#color/colorButton</item>
<item name="android:textColor">#android:color/white</item>
<item name="android:textColorPrimary">#android:color/white</item>
<item name="android:background">#color/dark</item>
<item name="background">#color/dark</item>
<item name="buttonBarPositiveButtonStyle">#style/alert_dialog_button_positive</item>
<item name="buttonBarNegativeButtonStyle">#style/alert_dialog_button_negative</item>
</style>
Thank you for any help.
I solved this issue. It turned out I mixed parent styles - MaterialComponents and AppCompat and once I standarize it the problem was gone.
I am using a custom Dark Theme in my app. Everything is doing okay, except for the Cut Copy Paste dialog that appears as a solid black square.
Surely there is a style that determines that, but I can't find it, or an answer that addresses this directly. Min API is 16.
<style name="DarkTheme" parent="AppTheme.NoActionBar">
<item name="colorPrimary">#color/blackBackground</item>
<item name="colorPrimaryDark">#color/blackBackground</item>
<item name="colorAccent">#color/yellow</item>
<item name="android:textColor">#color/whiteText</item>
<item name="android:background">#color/blackBackground</item>
<item name="buttonStyle">#style/darkButtonStyle</item>
<item name="spinnerStyle">#style/darkSpinnerStyle</item>
</style>
<style name="darkButtonStyle" parent="#android:style/Widget.Button">
<item name="android:layout_width">fill_parent</item>
<item name="android:textColor">#color/whiteText</item>
<item name="android:textSize">16sp</item>
<item name="android:padding">10dp</item>
<item name="android:textStyle">bold</item>
<item name="android:background">#color/darkBackground</item>
<item name="android:gravity">center</item>
<item name="android:textAllCaps">true</item>
</style>
<style name="darkSpinnerStyle" parent="Widget.AppCompat.Spinner">
<item name="android:background">#color/blackBackground</item>
<item name="android:paddingTop">0dp</item>
<item name="android:layout_marginStart">1dp</item>
<item name="android:layout_marginLeft">1dp</item>
<item name="android:layout_width">0dp</item>
<item name="android:layout_height">0dp</item>
</style>
I was having the same issue when regarding to MaterialAlertDialog. I was able to fix it using backgroundTint instead of background in styles. This is how:
Before
<style name="materialAlertDialog" parent="ThemeOverlay.MaterialComponents.MaterialAlertDialog">
<item name="android:background">#color/colorPrimaryDark</item>
<item name="materialAlertDialogTitleTextStyle">#style/TitleTextStyle</item>
<item name="materialAlertDialogBodyTextStyle">#style/BodyTextStyle</item>
<item name="buttonBarPositiveButtonStyle">#style/PositiveButtonStyle</item>
<item name="buttonBarNegativeButtonStyle">#style/NegativeButtonStyle</item>
</style>
This will be enough to repropduce the error that you are saying... So what i did was changing background for backgroundTint...
After
<style name="materialAlertDialog" parent="ThemeOverlay.MaterialComponents.MaterialAlertDialog">
<item name="android:backgroundTint">#color/colorPrimaryDark</item>
<item name="materialAlertDialogTitleTextStyle">#style/TitleTextStyle</item>
<item name="materialAlertDialogBodyTextStyle">#style/BodyTextStyle</item>
<item name="buttonBarPositiveButtonStyle">#style/PositiveButtonStyle</item>
<item name="buttonBarNegativeButtonStyle">#style/NegativeButtonStyle</item>
</style>
It seems like when you set a background and the dialog is created, the toolbar of copy/paste menu was changing his background in some weird way that i cant explain.
So this is not the exact answer for your problem but it may help you.
Note: Try removing background attr of your style. I have a dark theme and there is no need to use it. Just simple use <style name="AppTheme" parent="Theme.MaterialComponents.DayNight"> instead of <style name="DarkTheme" parent="AppTheme.NoActionBar">.
I use bellow style to change Dialog background color to dark, In preference page I use ListPreference and after apply this style, cancel button of ListPreference disappeared in dialog background.
<style name="AppThemeBase" parent="Theme.MaterialComponents.DayNight">
<item name="colorPrimary">#212D3B</item>
<item name="colorPrimaryDark">#172331</item>
<item name="colorAccent">#61A3D7</item>
<item name="android:textColorPrimary">#FFFFFF</item>
<item name="android:dialogTheme">#style/AppTheme.Dialog</item>
<item name="android:alertDialogTheme">#style/AppTheme.Dialog</item>
</style>
<style name="AppTheme.Dialog" parent="Theme.MaterialComponents.DayNight.Dialog">
<item name="android:windowBackground">#android:color/transparent</item>
<item name="android:background">#212D3B</item>
<item name="colorPrimary">#61A3D7</item>
<item name="colorPrimaryDark">#8DB2D3</item>
<item name="colorAccent">#61A3D7</item>
</style>
Is there a way to change this button color?
Finally I found solution. I don't understand what is different between android:alertDialogTheme and alertDialogTheme (without android:) but preference screen used the alertDialogTheme to stylize dialogs.
By adding bellow item to AppThemeBase, my problem is resolved.
<item name="alertDialogTheme">#style/AppTheme.Dialog</item>
Final AppThemeBase :
<style name="AppThemeBase" parent="Theme.MaterialComponents.DayNight">
<item name="colorPrimary">#212D3B</item>
<item name="colorPrimaryDark">#172331</item>
<item name="colorAccent">#61A3D7</item>
<item name="android:textColorPrimary">#FFFFFF</item>
<item name="android:dialogTheme">#style/AppTheme.Dialog</item>
<item name="android:alertDialogTheme">#style/AppTheme.Dialog</item>
<item name="alertDialogTheme">#style/AppTheme.Dialog</item>
</style>
<style name="AppTheme.Dialog" parent="Theme.MaterialComponents.DayNight.Dialog">
<item name="android:windowBackground">#android:color/transparent</item>
<item name="android:background">#212D3B</item>
<item name="colorPrimary">#61A3D7</item>
<item name="colorPrimaryDark">#8DB2D3</item>
<item name="colorAccent">#61A3D7</item>
</style>
See attached
I am using a searchbar with the theme below (I know very little about Android themes, yet)
How do I make the text typed, in this case, "Hi Mom" white?
<style name="_Credential" parent="android:Theme.Holo.Light.DarkActionBar">
<item name="android:editTextBackground">#drawable/credential_edit_text_holo_light</item>
<item name="android:textColorHighlight">#99005984</item>
<item name="android:textSelectHandleLeft">#drawable/credential_text_select_handle_left</item>
<item name="android:textSelectHandleRight">#drawable/credential_text_select_handle_right</item>
<item name="android:textSelectHandle">#drawable/credential_text_select_handle_middle</item>
<item name="android:autoCompleteTextViewStyle">#style/AutoCompleteTextViewCredential</item>
<item name="android:listChoiceIndicatorMultiple">#drawable/credential_btn_check_holo_light</item>
<item name="android:listChoiceIndicatorSingle">#drawable/credential_btn_radio_holo_light</item>
<item name="android:buttonStyle">#style/ButtonCredential</item>
<item name="android:imageButtonStyle">#style/ImageButtonCredential</item>
<item name="android:dropDownSpinnerStyle">#style/SpinnerCredential</item>
<item name="android:progressBarStyleHorizontal">#style/ProgressBarCredential</item>
<item name="android:seekBarStyle">#style/SeekBarCredential</item>
<item name="android:ratingBarStyle">#style/RatingBarCredential</item>
<item name="android:ratingBarStyleIndicator">#style/RatingBarBigCredential</item>
<item name="android:ratingBarStyleSmall">#style/RatingBarSmallCredential</item>
<item name="android:buttonStyleToggle">#style/ToggleCredential</item>
<item name="android:listChoiceBackgroundIndicator">#drawable/credential_list_selector_holo_light</item>
<item name="android:activatedBackgroundIndicator">#drawable/credential_activated_background_holo_light</item>
<item name="android:fastScrollThumbDrawable">#drawable/credential_fastscroll_thumb_holo</item>
</style>
<style name="_Credential" parent="android:Theme.Holo.Light.DarkActionBar">
...
<item name="android:editTextColor">#ffffff</item> <!--Allow to change the editText color-->
...
</style>
So you can't actually change the TextColor of something like a search box with android:textColor. Instead, you need to use the whole family of the textColor... attributes.
Create a custom style that has your main style as it's parent, and then change all three kinds of colors to be what you want. So, something like this:
<style name="master" paret="#android:Theme.Holo.Light.DarkActionBar">
<item name="android:textColorPrimary">#FFFFFF</item>
<item name="android:textColorSecondary">#FFFFFF</item>
<item name="android:textColorTertiary">#FFFFFF</item>
</style>
Read more about this here.
I want to make simple TabPagerIndicator, but It doesn't show a underline, I use xml to change the style. This is my xml style file:
<!-- Application theme. -->
<style name="AppTheme" parent="#style/Theme.AppCompat.Light">
<item name="vpiTitlePageIndicatorStyle">#style/CustomTitlePageIndicator</item>
<item name="vpiUnderlinePageIndicatorStyle">#style/CustomUnderlinePageIndicator</item>
<item name="vpiTabPageIndicatorStyle">#style/CustomTabPageIndicator</item>
</style>
<style name="CustomTabPageIndicator" parent="Widget.TabPageIndicator">
<item name="android:background">#color/fondo_activity</item>
<item name="android:textAppearance">#style/CustomTabPageIndicator.Text</item>
<item name="android:textColor">#FF555555</item>
<item name="android:textSize">14sp</item>
<item name="android:dividerPadding">10dp</item>
<item name="showDividers">middle</item>
<item name="android:paddingLeft">8dp</item>
<item name="android:paddingRight">8dp</item>
<item name="android:fadingEdge">horizontal</item>
<item name="android:fadingEdgeLength">8dp</item>
</style>
<style name="CustomTabPageIndicator.Text" parent="android:TextAppearance.Medium">
<item name="android:typeface">monospace</item>
</style>
<style name="CustomUnderlinePageIndicator">
<item name="selectedColor">#FFCC0000</item>
<item name="android:background">#FFCCCCCC</item>
<item name="fadeLength">1000</item>
<item name="fadeDelay">1000</item>
</style>
<style name="CustomTitlePageIndicator">
<item name="android:background">#18FF0000</item>
<item name="footerColor">#FFAA2222</item>
<item name="footerLineHeight">1dp</item>
<item name="footerIndicatorHeight">3dp</item>
<item name="footerIndicatorStyle">underline</item>
<item name="android:textColor">#AA000000</item>
<item name="selectedColor">#FF000000</item>
<item name="selectedBold">true</item>
</style>
In this picture you can see how it is shown (the red line on the top is part of the action bar)
Does anyone knows where is the error and How can I solve it?
Best.
Can you please elaborate on where exactly you want to show the underline? Do you mean a vertical line between FOTOS and VIDEOS? Since I was not able to understand your question properly. Still I try to answer.
If you want something like ( FOTOS | VIDEOS ) then you have to put
<item name="android:divider">#drawable/custom_tab_indicator_divider</item>
custom_tab_indicator_divider is basically a nine patch image. You can checkout the nine patch in the source code of viewpagerindicator library.
If you want something like __________ below the FOTO and VIDEOS.You can create a selector and set it to background like
<item name="android:background">#drawable/custom_tab_indicator</item>
Check vpi_tab_indicator.xml in the library project for more info.