We are using material components 1.0.0 and wanted to alter the style of MaterialButton across the app. We created our own styles extending the ones from components library. Right now we have something like:
<resources>
<style name="MyApp.Button" parent="Widget.MaterialComponents.Button">
<item name="android:minHeight">#dimen/action_button_min_height</item>
<item name="android:minWidth">#dimen/action_button_min_width</item>
<item name="android:fontFamily">#fonts/customFont</item>
<item name="android:singleLine">true</item>
<item name="android:textAllCaps">false</item>
<item name="android:paddingLeft">8dp</item>
<item name="android:paddingRight">8dp</item>
<item name="android:insetTop">0dp</item>
<item name="android:insetBottom">0dp</item>
</style>
<style name="MyApp.Button.Unelevated" parent="Widget.MaterialComponents.Button.UnelevatedButton">
<item name="android:minHeight">#dimen/action_button_min_height</item>
<item name="android:minWidth">#dimen/action_button_min_width</item>
<item name="android:fontFamily">#fonts/customFont</item>
<item name="android:singleLine">true</item>
<item name="android:textAllCaps">false</item>
<item name="android:paddingLeft">8dp</item>
<item name="android:paddingRight">8dp</item>
<item name="android:insetTop">0dp</item>
<item name="android:insetBottom">0dp</item>
</style>
<style name="MyApp.Button.Text" parent="Widget.MaterialComponents.Button.TextButton">
<item name="android:minHeight">#dimen/action_button_min_height</item>
<item name="android:minWidth">#dimen/action_button_min_width</item>
<item name="android:fontFamily">#fonts/customFont</item>
<item name="android:singleLine">true</item>
<item name="android:textAllCaps">false</item>
<item name="android:paddingLeft">8dp</item>
<item name="android:paddingRight">8dp</item>
<item name="android:insetTop">0dp</item>
<item name="android:insetBottom">0dp</item>
</style>
<style name="MyApp.Button.Outlined" parent="Widget.MaterialComponents.Button.OutlinedButton">
<item name="android:minHeight">#dimen/action_button_min_height</item>
<item name="android:minWidth">#dimen/action_button_min_width</item>
<item name="android:fontFamily">#fonts/customFont</item>
<item name="android:singleLine">true</item>
<item name="android:textAllCaps">false</item>
<item name="android:paddingLeft">8dp</item>
<item name="android:paddingRight">8dp</item>
<item name="android:insetTop">0dp</item>
<item name="android:insetBottom">0dp</item>
</style>
</resources>
Is there a way to avoid defining same values for every style?
Since you are using different parent styles you can only semplify some attributes, but not all.
For example you can define:
<style name="MyButtonTextAppearance" parent="#style/TextAppearance.MaterialComponents.Button>
<item name="fontFamily">.....</item>
<item name="android:fontFamily">...</item>
<item name="android:textStyle">...</item>
<item name="android:textAllCaps">...</item>
<item name="android:textSize">...</item>
<item name="android:letterSpacing">...</item>
</style>
And in your styles you can remove the same attributes using:
<style name="MyApp.Button" parent="Widget.MaterialComponents.Button">
....
<item name="android:textAppearance">#style/MyButtonTextAppearance</item>
</style>
Related
I am useing the following xml to syle my showcaseview, but for some reason the button is darker then the original image, any idea?
<style name="ShowcaseButton">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:paddingTop">10dp</item>
<item name="android:paddingBottom">10dp</item>
<item name="android:paddingLeft">20dp</item>
<item name="android:paddingRight">20dp</item>
<item name="android:textColor">#000000</item>
<item name="android:background">#drawable/continueknop</item>
</style>
<style name="CustomShowcaseTheme" parent="ShowcaseView">
<item name="sv_backgroundColor">#AA010101</item>
<item name="sv_showcaseColor">#color/actionbar</item>
<item name="sv_buttonText">Continue</item>
<item name="sv_titleTextAppearance">#style/CustomTitle</item>
<item name="sv_detailTextAppearance">#style/Customdesc</item>
</style>
<style name="CustomTitle" parent="TextAppearance.ShowcaseView.Title">
<item name="android:textColor">#FFFFFF</item>
</style>
<style name="Customdesc" parent="TextAppearance.ShowcaseView.Title">
<item name="android:textColor">#FFFFFF</item>
<item name="android:textSize">18sp</item>
</style>
so i downloaded a zip file from http://jgilfelt.github.io/android-actionbarstylegenerator/ after i had done all my custom styling , and i added the various drawables files in their respective folders. But for some reason ,when i run my app, the styles on the actionBar hasnt changed. Also i did target this custom styling in my androidManifestFile, that is i did android:theme="#style/Theme.Snapshare" . bellow is my styles.xml file in my values folder.
<resources>
<style name="Theme.Snapshare" parent="#style/Theme.AppCompat.Light.DarkActionBar">
<item name="android:actionBarItemBackground">#drawable/selectable_background_snapshare
</item>
<item name="android:popupMenuStyle">#style/PopupMenu.Snapshare</item>
<item name="android:dropDownListViewStyle">#style/DropDownListView.Snapshare</item>
<item name="android:actionBarTabStyle">#style/ActionBarTabStyle.Snapshare</item>
<item name="android:actionDropDownStyle">#style/DropDownNav.Snapshare</item>
<item name="android:actionBarStyle">#style/ActionBar.Solid.Snapshare</item>
<item name="android:actionModeBackground">#drawable/cab_background_top_snapshare</item>
<item name="android:actionModeSplitBackground">#drawable/cab_background_bottom_snapshare
</item>
<item name="android:actionModeCloseButtonStyle">#style/ActionButton.CloseMode.Snapshare
</item>
<item name="android:editTextBackground">#drawable/apptheme_edit_text_holo_light</item>
</style>
<style name="ActionBar.Solid.Snapshare" parent="#android:style/Widget.Holo.Light.ActionBar.Solid">
<item name="android:background">#drawable/ab_solid_snapshare</item>
<item name="android:backgroundStacked">#drawable/ab_stacked_solid_snapshare</item>
<item name="android:backgroundSplit">#drawable/ab_bottom_solid_snapshare</item>
<item name="android:progressBarStyle">#style/ProgressBar.Snapshare</item>
</style>
<style name="ActionBar.Transparent.Snapshare" parent="#android:style/Widget.Holo.Light.ActionBar">
<item name="android:background">#drawable/ab_transparent_snapshare</item>
<item name="android:progressBarStyle">#style/ProgressBar.Snapshare</item>
</style>
<style name="PopupMenu.Snapshare" parent="#android:style/Widget.Holo.Light.ListPopupWindow">
<item name="android:popupBackground">#drawable/menu_dropdown_panel_snapshare</item>
</style>
<style name="DropDownListView.Snapshare"
parent="#android:style/Widget.Holo.Light.ListView.DropDown">
<item name="android:listSelector">#drawable/selectable_background_snapshare</item>
</style>
<style name="ActionBarTabStyle.Snapshare"
parent="#android:style/Widget.Holo.Light.ActionBar.TabView">
<item name="android:background">#drawable/tab_indicator_ab_snapshare</item>
</style>
<style name="DropDownNav.Snapshare" parent="#android:style/Widget.Holo.Light.Spinner">
<item name="android:background">#drawable/spinner_background_ab_snapshare</item>
<item name="android:popupBackground">#drawable/menu_dropdown_panel_snapshare</item>
<item name="android:dropDownSelector">#drawable/selectable_background_snapshare</item>
</style>
<style name="ProgressBar.Snapshare"
parent="#android:style/Widget.Holo.Light.ProgressBar.Horizontal">
<item name="android:progressDrawable">#drawable/progress_horizontal_snapshare</item>
</style>
<style name="ActionButton.CloseMode.Snapshare"
parent="#android:style/Widget.Holo.Light.ActionButton.CloseMode">
<item name="android:background">#drawable/btn_cab_done_snapshare</item>
</style>
<!-- this style is only referenced in a Light.DarkActionBar based theme -->
<style name="Theme.Snapshare.Widget" parent="#android:style/Theme.Holo">
<item name="android:popupMenuStyle">#style/PopupMenu.Snapshare</item>
<item name="android:dropDownListViewStyle">#style/DropDownListView.Snapshare</item>
</style>
<style name="AuthBackground">
<item name="android:background">#drawable/background_fill</item>
</style>
<style name="AuthBackgroundImage">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">match_parent</item>
<item name="android:layout_alignParentBottom">true</item>
<item name="android:layout_alignParentRight">true</item>
<item name="android:background">#drawable/background</item>
<item name="android:scaleType">fitStart</item>
<item name="android:contentDescription">#string/content_desc_background</item>
</style>
<style name="AuthTitle">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textSize">60sp</item>
<item name="android:layout_alignParentTop">true</item>
<item name="android:layout_centerHorizontal">true</item>
<item name="android:textColor">#android:color/white</item>
<item name="android:textStyle">bold</item>
<item name="android:layout_marginTop">78dp</item>
<item name="android:text">#string/app_name</item>
</style>
<style name="AuthSubTitle" parent="AuthTitle">
<item name="android:layout_below">#+id/title</item>
<item name="android:textSize">13sp</item>
<item name="android:text">#string/subtitle</item>
<item name="android:layout_marginTop">0dp</item>
<item name="android:layout_alignParentTop">false</item>
</style>
<style name="AuthFieldContainer">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_below">#id/subtitle</item>
<item name="android:orientation">vertical</item>
<item name="android:layout_marginTop">#dimen/login_vertical_margin</item>
<item name="android:layout_marginLeft">#dimen/activity_horizontal_margin</item>
<item name="android:layout_marginRight">#dimen/activity_horizontal_margin</item>
<item name="android:paddingLeft">#dimen/login_horizontal_padding</item>
<item name="android:paddingRight">#dimen/login_horizontal_padding</item>
<item name="android:paddingTop">#dimen/login_vertical_margin</item>
<item name="android:paddingBottom">#dimen/login_vertical_margin</item>
<item name="android:background">#android:color/white</item>
</style>
<style name="AuthEditText">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textColorHint">#color/light_gray</item>
<item name="android:textSize">17sp</item>
<item name="android:ems">10</item>
</style>
<style name="AuthButton">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:background">#drawable/button_custom</item>
<item name="android:layout_marginLeft">#dimen/activity_horizontal_margin</item>
<item name="android:layout_marginRight">#dimen/activity_horizontal_margin</item>
<item name="android:textSize">13sp</item>
<item name="android:textColor">#color/text_color</item>
</style>
</resources>
also my MainActivity is extending ActionBarActivity, that is
public class MainActivity extends ActionBarActivity implements ActionBar.TabListener {
public static final String TAG = MainActivity.class.getSimpleName();
My action bare menu items have back text in Android 5.0. I am trying to change it to white but the style for android:actionMenuTextColor seems to be ignored and the text appears black
How can I change the menu item text color to white?
Here is my styles.xml i do not have a theme.xml
<style name="Theme.Red" parent="#style/Theme.AppCompat.Light.DarkActionBar">
<item name="actionBarItemBackground">#drawable/selectable_background_red</item>
<item name="popupMenuStyle">#style/PopupMenu.Red</item>
<item name="dropDownListViewStyle">#style/DropDownListView.Red</item>
<item name="actionBarTabStyle">#style/ActionBarTabStyle.Red</item>
<item name="actionDropDownStyle">#style/DropDownNav.Red</item>
<item name="actionBarStyle">#style/ActionBar.Solid.Red</item>
<item name="actionModeBackground">#drawable/cab_background_top_red</item>
<item name="actionModeSplitBackground">#drawable/cab_background_bottom_red</item>
<item name="actionModeCloseButtonStyle">#style/ActionButton.CloseMode.Red</item>
<!-- Light.DarkActionBar specific -->
<item name="actionBarWidgetTheme">#style/Theme.Red.Widget</item>
<item name="android:editTextBackground">#drawable/red_edit_text_holo_light</item>
<item name="android:textColorHighlight">#99e84e40</item>
<item name="android:textSelectHandleLeft">#drawable/red_text_select_handle_left</item>
<item name="android:textSelectHandleRight">#drawable/red_text_select_handle_right</item>
<item name="android:textSelectHandle">#drawable/red_text_select_handle_middle</item>
<item name="android:autoCompleteTextViewStyle">#style/AutoCompleteTextViewred</item>
<item name="android:listChoiceIndicatorMultiple">#drawable/red_btn_check_holo_light</item>
<item name="android:listChoiceIndicatorSingle">#drawable/red_btn_radio_holo_light</item>
<item name="android:buttonStyle">#style/Buttonred</item>
<item name="android:imageButtonStyle">#style/ImageButtonred</item>
<item name="android:dropDownSpinnerStyle">#style/Spinnerred</item>
<item name="android:progressBarStyleHorizontal">#style/ProgressBarred</item>
<item name="android:seekBarStyle">#style/SeekBarred</item>
<item name="android:ratingBarStyle">#style/RatingBarred</item>
<item name="android:ratingBarStyleIndicator">#style/RatingBarBigred</item>
<item name="android:ratingBarStyleSmall">#style/RatingBarSmallred</item>
<item name="android:buttonStyleToggle">#style/Togglered</item>
<item name="android:listChoiceBackgroundIndicator">#drawable/red_list_selector_holo_light</item>
<item name="android:activatedBackgroundIndicator">#drawable/red_activated_background_holo_light</item>
<item name="android:fastScrollThumbDrawable">#drawable/red_fastscroll_thumb_holo</item>
<item name="android:actionMenuTextColor">#color/white</item>
</style>
<style name="myCustomMenuTextApearance" parent="#android:style/TextAppearance.Widget.IconMenu.Item">
<item name="android:textColor">#android:color/primary_text_dark</item>
</style>
<style name="ActionBar.Solid.Red" parent="#style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<item name="background">#drawable/ab_solid_red</item>
<item name="backgroundStacked">#drawable/ab_stacked_solid_red</item>
<item name="backgroundSplit">#drawable/ab_bottom_solid_red</item>
<item name="progressBarStyle">#style/ProgressBar.Red</item>
</style>
<style name="ActionBar.Transparent.Red" parent="#style/Widget.AppCompat.ActionBar">
<item name="background">#drawable/ab_transparent_red</item>
<item name="progressBarStyle">#style/ProgressBar.Red</item>
</style>
<style name="PopupMenu.Red" parent="#style/Widget.AppCompat.PopupMenu">
<item name="android:popupBackground">#drawable/menu_dropdown_panel_red</item>
</style>
<style name="DropDownListView.Red" parent="#style/Widget.AppCompat.ListView.DropDown">
<item name="android:listSelector">#drawable/selectable_background_red</item>
</style>
<style name="ActionBarTabStyle.Red" parent="#style/Widget.AppCompat.ActionBar.TabView">
<item name="android:background">#drawable/tab_indicator_ab_red</item>
</style>
<style name="DropDownNav.Red" parent="#style/Widget.AppCompat.Spinner.DropDown.ActionBar">
<item name="android:background">#drawable/spinner_background_ab_red</item>
<item name="android:popupBackground">#drawable/menu_dropdown_panel_red</item>
<item name="android:dropDownSelector">#drawable/selectable_background_red</item>
</style>
<style name="ProgressBar.Red" parent="#style/Widget.AppCompat.ProgressBar.Horizontal">
<item name="android:progressDrawable">#drawable/progress_horizontal_red</item>
</style>
<style name="ActionButton.CloseMode.Red" parent="#style/Widget.AppCompat.ActionButton.CloseMode">
<item name="android:background">#drawable/btn_cab_done_red</item>
</style>
<!-- this style is only referenced in a Light.DarkActionBar based theme -->
<style name="Theme.Red.Widget" parent="#style/Theme.AppCompat">
<item name="popupMenuStyle">#style/PopupMenu.Red</item>
<item name="dropDownListViewStyle">#style/DropDownListView.Red</item>
</style>
<style name="AutoCompleteTextViewred" parent="android:Widget.Holo.Light.AutoCompleteTextView">
<item name="android:dropDownSelector">#drawable/red_list_selector_holo_light</item>
<item name="android:background">#drawable/red_edit_text_holo_light</item>
</style>
<style name="Buttonred" parent="android:Widget.Holo.Light.Button">
<item name="android:background">#drawable/red_btn_default_holo_light</item>
</style>
<style name="ImageButtonred" parent="android:Widget.Holo.Light.ImageButton">
<item name="android:background">#drawable/red_btn_default_holo_light</item>
</style>
<style name="Spinnerred" parent="android:Widget.Holo.Light.Spinner">
<item name="android:background">#drawable/red_spinner_background_holo_light</item>
<item name="android:dropDownSelector">#drawable/red_list_selector_holo_light</item>
</style>
<style name="Tabred">
<item name="android:gravity">center_horizontal</item>
<item name="android:paddingLeft">16dip</item>
<item name="android:paddingRight">16dip</item>
<item name="android:background">#drawable/red_tab_indicator_holo</item>
<item name="android:layout_width">0dip</item>
<item name="android:layout_weight">1</item>
<item name="android:minWidth">80dip</item>
</style>
<style name="TabTextred">
<item name="android:textColor">#000000</item>
<item name="android:textSize">12sp</item>
<item name="android:textStyle">bold</item>
<!-- v14 <item name="android:textAllCaps">true</item> -->
<item name="android:ellipsize">marquee</item>
<item name="android:maxLines">2</item>
<item name="android:maxWidth">180dip</item>
</style>
<style name="ProgressBarred" parent="android:Widget.Holo.Light.ProgressBar.Horizontal">
<item name="android:progressDrawable">#drawable/red_progress_horizontal_holo_light</item>
<item name="android:indeterminateDrawable">#drawable/red_progress_indeterminate_horizontal_holo_light</item>
</style>
<style name="SeekBarred" parent="android:Widget.Holo.Light.SeekBar">
<item name="android:progressDrawable">#drawable/red_scrubber_progress_horizontal_holo_light</item>
<item name="android:indeterminateDrawable">#drawable/red_scrubber_progress_horizontal_holo_light</item>
<item name="android:thumb">#drawable/red_scrubber_control_selector_holo_light</item>
</style>
<style name="RatingBarred" parent="android:Widget.Holo.Light.RatingBar">
<item name="android:progressDrawable">#drawable/red_ratingbar_full_holo_light</item>
<item name="android:indeterminateDrawable">#drawable/red_ratingbar_full_holo_light</item>
</style>
<style name="RatingBarBigred" parent="android:Widget.Holo.Light.RatingBar.Indicator">
<item name="android:progressDrawable">#drawable/red_ratingbar_holo_light</item>
<item name="android:indeterminateDrawable">#drawable/red_ratingbar_holo_light</item>
</style>
<style name="RatingBarSmallred" parent="android:Widget.Holo.Light.RatingBar.Small">
<item name="android:progressDrawable">#drawable/red_ratingbar_small_holo_light</item>
<item name="android:indeterminateDrawable">#drawable/red_ratingbar_small_holo_light</item>
</style>
<style name="Togglered" parent="android:Widget.Holo.Light.Button.Toggle">
<item name="android:background">#drawable/red_btn_toggle_holo_light</item>
</style>
Try to add to your values-v21:
<item name="android:actionBarPopupTheme">#style/Theme.Red.Widget</item>
I'm developing an android app.
I'm using ZXING fragment open source barcode scanning.
I have an option to manually input the barcode. So when the user press the manual input button I open a dialog with edit text. Before the dialog appears I pause the camera and scanning.
This causes the device to hang, the top bar multiples it self adding it self more and more times until it fills the display. The only way to get out of this situation is to restart the device.
This bug only reproduce in Nexus 5
How can I debug this in DDMS?
I'm clueless :P Any ideas?!
This is how the device looks when this happens and you must restart the device:
Here are my Theme and Styles files as asked by #Apoorv
themes.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- the theme applied to the application or activity -->
<style name="MybusinessTheme"
parent="#style/Theme.AppCompat.Light">
<item name="android:actionBarStyle">#style/MybusinessActionBar</item>
<item name="android:actionMenuTextColor">#color/white</item>
<item name="android:homeAsUpIndicator">#drawable/ic_home_up</item>
<item name="android:actionOverflowButtonStyle">#style/MybusinessButtonOverFlow</item>
<!-- Remove the shadow of the actionbar -->
<item name="android:windowContentOverlay">#null</item>
<!-- Support library compatibility -->
<item name="actionBarStyle">#style/MybusinessActionBar</item>
<item name="actionMenuTextColor">#color/white</item>
<item name="homeAsUpIndicator">#drawable/ic_home_up</item>
<item name="actionOverflowButtonStyle">#style/MybusinessButtonOverFlow</item>
<!-- For app launching -->
<item name="android:windowBackground">#color/wrntr_purple</item>
</style>
<!-- ActionBar styles -->
<style name="MybusinessActionBar"
parent="#style/Widget.AppCompat.Light.ActionBar">
<item name="android:background">#color/wrntr_purple</item>
<item name="android:titleTextStyle">#style/WarrenteerActionBarTitleText</item>
<!-- Support library compatibility -->
<item name="background">#color/wrntr_purple</item>
<item name="titleTextStyle">#style/WarrenteerActionBarTitleText</item>
</style>
<!-- Over flow button style -->
<style name="MybusinessButtonOverFlow"
parent="#style/Widget.AppCompat.Light.ActionButton.Overflow">
<item name="android:src">#drawable/ic_action_overflow</item>
</style>
<!-- ActionBar title text -->
<style name="WarrenteerActionBarTitleText"
parent="#style/TextAppearance.AppCompat.Widget.ActionBar.Title">
<item name="android:textColor">#color/white</item>
</style>
<style name="MybusinessTheme.Wallpaper"
parent="MybusinessTheme">
</style>
</resources>
styles.xml
<resources>
<style name="ActivityBase">
<item name="android:background">#color/white</item>
</style>
<style name="NextButton">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_alignParentBottom">true</item>
<item name="android:layout_alignParentLeft">true</item>
<item name="android:textSize">#dimen/medium_text</item>
<item name="android:textColor">#drawable/next_button_text_color</item>
<item name="android:gravity">center</item>
<item name="android:layout_marginLeft">20dp</item>
<item name="android:layout_marginBottom">20dp</item>
<item name="android:padding">5dp</item>
<item name="android:background">#drawable/next_button_selector</item>
</style>
<style name="PreviousButton" parent="NextButton">
<item name="android:layout_alignParentLeft">false</item>
<item name="android:layout_alignParentRight">true</item>
<item name="android:layout_marginRight">20dp</item>
</style>
<style name="DescriptionText">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_below">#id/welcomeText</item>
<item name="android:textSize">#dimen/medium_text</item>
<item name="android:textColor">#color/mybiz_dark_gray</item>
</style>
<style name="NormalButton">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:padding">10dp</item>
<item name="android:layout_margin">10dp</item>
<item name="android:textColor">#color/white</item>
<item name="android:background">#drawable/button_selector</item>
<item name="android:gravity">center</item>
</style>
<style name="NormalBoldButton">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:padding">10dp</item>
<item name="android:layout_margin">10dp</item>
<item name="android:textColor">#color/white</item>
<item name="android:background">#drawable/button_selector</item>
<item name="android:textStyle">bold</item>
<item name="android:gravity">center</item>
</style>
<style name="LightButton">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:padding">10dp</item>
<item name="android:layout_margin">10dp</item>
<item name="android:textColor">#color/mybiz_dark_gray</item>
<item name="android:background">#drawable/light_button_selector</item>
<item name="android:gravity">center</item>
</style>
<style name="TitleText">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textColor">#color/mybiz_dark_gray</item>
<item name="android:textStyle">bold</item>
<item name="android:textSize">#dimen/xx_large_text</item>
</style>
<style name="WizardProgressNumber">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textColor">#color/white</item>
<item name="android:paddingBottom">4dp</item>
<item name="android:paddingTop">7dp</item>
<item name="android:paddingRight">9dp</item>
<item name="android:paddingLeft">9dp</item>
<item name="android:layout_gravity">center</item>
<item name="android:gravity">center</item>
<item name="android:layout_marginLeft">6dp</item>
<item name="android:background">#drawable/white_circle</item>
</style>
<style name="WizardProgressViewDefault">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:padding">5dp</item>
<item name="android:layout_marginRight">15dp</item>
<item name="android:layout_marginTop">#dimen/add_other_device_space</item>
<item name="android:layout_marginBottom">#dimen/add_other_device_space</item>
</style>
<style name="NavigationDrawer">
<item name="android:layout_width">240dp</item>
<item name="android:layout_height">match_parent</item>
<item name="android:layout_gravity">start</item>
<item name="android:choiceMode">singleChoice</item>
<item name="android:divider">#color/mybiz_light_gray</item>
<item name="android:dividerHeight">1dp</item>
<item name="android:background">#android:color/white</item>
</style>
<style name="HomeMenuItem">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textColor">#color/gray_turquoise_selector</item>
<item name="android:textSize">#dimen/medium_text</item>
<item name="android:layout_gravity">center</item>
<item name="android:gravity">center_vertical</item>
<item name="android:layout_margin">10dp</item>
<item name="android:paddingTop">3dp</item>
<item name="android:drawablePadding">10dp</item>
</style>
<style name="ProductListItem">
<item name="android:layout_alignParentRight">true</item>
<item name="android:layout_marginRight">15dp</item>
</style>
<style name="ObjectSeekBar">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">10dp</item>
<item name="android:layout_marginTop">12dp</item>
<item name="android:layout_marginLeft">5dp</item>
<item name="android:layout_marginRight">5dp</item>
<item name="android:padding">0dp</item>
<item name="android:thumb">#null</item>
<item name="android:progressDrawable">#drawable/days_left_progress</item>
</style>
<style name="ObjectBoldSmallText">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textSize">#dimen/small_text</item>
<item name="android:textColor">#color/mybiz_dark_gray</item>
<item name="android:layout_marginRight">15dp</item>
<item name="android:layout_gravity">right</item>
<item name="android:textStyle">bold</item>
</style>
<style name="ObjectSmallText">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textSize">#dimen/small_text</item>
<item name="android:textColor">#color/mybiz_dark_gray</item>
<item name="android:layout_marginRight">15dp</item>
<item name="android:layout_gravity">right</item>
</style>
<style name="ObjectMediumText" parent="ProductListItem">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textSize">#dimen/medium_text</item>
<item name="android:textColor">#color/mybiz_purple</item>
<item name="android:layout_gravity">right</item>
</style>
<style name="ObjectMediumLargeText" parent="ProductListItem">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textSize">#dimen/medium_large_text</item>
<item name="android:textColor">#color/mybiz_purple</item>
<item name="android:layout_gravity">right</item>
</style>
<style name="ObjectLargeText" parent="ProductListItem">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textSize">#dimen/large_text</item>
<item name="android:textColor">#color/mybiz_purple</item>
<item name="android:layout_gravity">right</item>
</style>
<style name="HorizontalLineGray">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">1dp</item>
<item name="android:layout_marginTop">5dp</item>
<item name="android:background">#color/mybiz_gray</item>
</style>
<style name="HorizontalLineLightGray">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">0.5dp</item>
<item name="android:layout_marginTop">5dp</item>
<item name="android:background">#color/mybiz_light_gray</item>
</style>
<style name="buttonWhiteBorder">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_gravity">right</item>
<item name="android:textColor">#drawable/button_text_color_selector_white</item>
<item name="android:paddingTop">10dp</item>
<item name="android:paddingBottom">10dp</item>
<item name="android:paddingLeft">20dp</item>
<item name="android:paddingRight">20dp</item>
<item name="android:layout_marginRight">15dp</item>
<item name="android:background">#drawable/button_selector_white_transparent</item>
</style>
<style name="ManualInputButton" parent="buttonWhiteBorder">
<item name="android:layout_marginTop">#dimen/add_other_device_space</item>
<item name="android:layout_alignParentLeft">true</item>
<item name="android:layout_marginLeft">15dp</item>
</style>
<style name="ButtonTurquoiseBorder">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textColor">#drawable/button_text_color_selector_turquoise</item>
<item name="android:background">#drawable/button_selector_turquoise_transparent</item>
</style>
<style name="EditBoldTextLabel" parent="ObjectBoldSmallText">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:gravity">right</item>
<item name="android:layout_marginRight">20dp</item>
<item name="android:layout_marginTop">25dp</item>
</style>
<style name="EditTextLabel" parent="ObjectSmallText">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:gravity">right</item>
<item name="android:layout_marginRight">20dp</item>
<item name="android:layout_marginTop">25dp</item>
</style>
<style name="EditTextManualInputLabel" parent="EditBoldTextLabel">
<item name="android:textColor">#color/white</item>
</style>
<style name="EditTextNormal">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_marginRight">20dp</item>
<item name="android:layout_marginLeft">20dp</item>
<item name="android:imeOptions">actionNext</item>
<item name="android:singleLine">true</item>
</style>
<style name="EditTextManualInput" parent="EditTextNormal">
<item name="android:textColorHint">#color/mybiz_light_gray</item>
<item name="android:textColor">#color/white</item>
<item name="android:background">#drawable/edit_text_white_selector</item>
</style>
<style name="LargeTextTitle" parent="ObjectLargeText">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textStyle">bold</item>
<item name="android:textColor">#color/mybiz_dark_gray</item>
<item name="android:layout_marginTop">25dp</item>
</style>
<style name="MediumTextTitle" parent="ObjectMediumText">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textStyle">bold</item>
<item name="android:textColor">#color/mybiz_dark_gray</item>
<item name="android:layout_marginTop">25dp</item>
</style>
</resources>
OK we had the same problem - Nexus 5 only, but with ZBar lib instead of ZXing.
The issue was resolved by switching from a SurfaceView to a TextureView - however this resulted in slower frame rates.
Through testing we found that our issue was caused by leaving the screen, bringing up the keyboard and going back - our solution was setting android:windowSoftInputMode to AdjustPan in the manifest.
Hope this helps!
Does anyone have an idea how to add the style "MarginButton" to the style "bluebutton" or "OrangeButton"? The reason I'm doing this is to prevent double code, is this the correct way to do or are there better ways to solve this?
<style name="OrangeButton" parent="android:Widget.Button">
<item name="android:textColor">#000</item>
<item name="android:background">#drawable/roundedbutton_orange</item>
</style>
<style name="BlueButton" parent="android:Widget.Button">
<item name="android:textColor">#FFF</item>
<item name="android:background">#drawable/roundedbutton_blue</item>
</style>
<style name="MarginButton" parent="android:Widget.Button">
<item name="android:layout_marginTop">10dp</item>
<item name="android:layout_marginBottom">10dp</item>
<item name="android:layout_marginLeft">3dp</item>
<item name="android:layout_marginRight">3dp</item>
</style>
Thnx,
Joris
Update
Set your orange button parent to #style/MarginButton. I've just tried this and it's working,
<style name="orangeButton" parent="#style/MarginButton">
<item name="android:textColor">#000</item>
<item name="android:background">#drawable/roundedbutton_orange</item>
</style>
<style name="MarginButton" parent="#android:style/Widget.Button">
<item name="android:layout_marginTop">10dp</item>
<item name="android:layout_marginBottom">10dp</item>
<item name="android:layout_marginLeft">3dp</item>
<item name="android:layout_marginRight">3dp</item>
</style>
I think that you can obtain it by doing:
Buttons.xml ->
<style name="OrangeButton" parent="MarginButton">
<item name="android:textColor">#000</item>
<item name="android:background">#drawable/roundedbutton_orange</item>
</style>
<style name="BlueButton" parent="MarginButton">
<item name="android:textColor">#FFF</item>
<item name="android:background">#drawable/roundedbutton_blue</item>
</style>
MarginButton.xml ->
<style name="MarginButton" parent="android:Widget.Button">
<item name="android:layout_marginTop">10dp</item>
<item name="android:layout_marginBottom">10dp</item>
<item name="android:layout_marginLeft">3dp</item>
<item name="android:layout_marginRight">3dp</item>
</style>
If you guys want to use borderless button like me or use two style. Try it.
View ->
<com.google.android.material.button.MaterialButton
android:id="#+id/btnCreateNewAcc"
android:text="#string/or_create_a_new_account"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/textView4"
style="#style/textButtonStyle"
/>
Style ->
<style name="textButtonStyle" parent="android:Widget.Material.Button.Borderless">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:insetTop">0dp</item>
<item name="android:insetBottom">0dp</item>
<item name="android:minWidth">0dp</item>
<item name="android:minHeight">0dp</item>
<item name="android:padding">0dp</item>
<item name="android:fontFamily">#font/inter</item>
<item name="android:textAllCaps">false</item>
<item name="android:textColor">#color/grey</item>
<item name="android:textFontWeight">400</item>
<item name="android:textSize">15sp</item>
<item name="android:background">#android:color/transparent</item>
</style>
You can do it changing the parent attribute. For example:
<style name="BlueButton" parent="MarginButton">
<item name="android:textColor">#FFF</item>
<item name="android:background">#drawable/roundedbutton_blue</item>
</style>