Android Material Edit Text endIcon - android

I've added an EditText view from Google's material library and set the endIcon mode to clear_text. However, the endIcon is too big (it fits the text view entirely), whereas, from looking at the documentation, I believe it should be a little smaller. I tried to play around with the layout XML but can't seem to find out why this is. I've also looked at the endIcon attributes in the Material repository and there seems to be no endIconSize attribute. I'd appreciate it if someone could point out where I made the mistake.
TextView XML
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/descriptionTextField"
style="#style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
app:boxBackgroundColor="#android:color/white"
app:boxStrokeColor="#color/colorSecondaryLight"
app:boxStrokeWidth="2dp"
app:endIconMode="clear_text"
app:errorEnabled="false"
app:layout_constraintBottom_toBottomOf="#+id/taskConfirmedBtn"
app:layout_constraintEnd_toStartOf="#+id/taskConfirmedBtn"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="#+id/taskConfirmedBtn">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/descriptionInput"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="sans-serif"
android:inputType="textCapSentences"
android:singleLine="true"
android:textColor="#color/colorOnSurface" />
Styles xml
<resources>
<!-- Base application theme -->
<style name="AppTheme" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<item name="android:colorBackground">#color/background</item>
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryVariant">#color/colorPrimaryLight</item>
<item name="colorOnPrimary">#color/colorOnPrimary</item>
<item name="colorSecondary">#color/colorSecondary</item>
<item name="colorSecondaryVariant">#color/colorSecondaryLight</item>
<item name="colorOnSecondary">#color/colorOnSecondary</item>
<item name="toolbarStyle">#style/Widget.Taskeroo.Toolbar</item>
<item name="actionBarTheme">#style/Widget.Taskeroo.ActionBar</item>
<item name="floatingActionButtonStyle">#style/Widget.Taskeroo.FloatingActionButton</item>
<item name="imageButtonStyle">#style/Widget.Taskeroo.ImageButton</item>
<item name="materialCardViewStyle">#style/Widget.Taskeroo.CardView</item>
<item name="bottomSheetDialogTheme">#style/CustomBottomSheetDialog</item>
<item name="android:textViewStyle">#style/SanSerifLightTextView</item>
<item name="android:buttonStyle">#style/SansSerifLightButton</item>
<item name="android:radioButtonStyle">#style/SansSerifLightButton</item>
</style>
<!-- Themes -->
<style name="SplashScreenTheme" parent="AppTheme.NoActionBar">
<item name="android:windowBackground">#drawable/splash_screen_bitmap</item>
</style>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
<style name="AppTheme.NoActionBar.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.NoActionBar.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
<!-- Widgets -->
<style name="Widget.Taskeroo.ActionBar" parent="Widget.MaterialComponents.ActionBar.Primary">
<item name="android:colorControlNormal">#color/colorOnPrimary</item>
<item name="android:iconTint">#color/colorOnPrimary</item>
</style>
<style name="Widget.Taskeroo.Toolbar" parent="Widget.MaterialComponents.Toolbar.Primary">
<item name="titleTextColor">#color/colorOnPrimary</item>
</style>
<style name="Widget.Taskeroo.FloatingActionButton" parent="Widget.MaterialComponents.FloatingActionButton">
<item name="android:backgroundTint">#color/colorSecondaryLight</item>
<item name="tint">#color/colorOnSecondary</item>
</style>
<style name="Widget.Taskeroo.CardView" parent="Widget.MaterialComponents.CardView">
<item name="cardBackgroundColor">#color/colorSurface</item>
<item name="cardElevation">10dp</item>
<item name="android:elevation">8dp</item>
</style>
<style name="DividerStyle">
<item name="android:background">#color/colorSecondary</item>
</style>
<style name="Widget.Taskeroo.ImageButton" parent="Widget.AppCompat.Button.Borderless.Colored">
<item name="tint">#color/colorSecondary</item>
</style>
<!-- Components -->
<style name="CustomBottomSheetDialog" parent="#style/ThemeOverlay.MaterialComponents.BottomSheetDialog">
<item name="bottomSheetStyle">#style/CustomBottomSheet</item>
</style>
<style name="CustomBottomSheet" parent="Widget.MaterialComponents.BottomSheet">
<item name="shapeAppearanceOverlay">#style/CustomShapeAppearanceBottomSheetDialog</item>
<item name="backgroundTint">#color/colorSurface</item>
</style>
<style name="CustomShapeAppearanceBottomSheetDialog" parent="">
<item name="cornerFamily">rounded</item>
<item name="cornerSizeTopRight">16dp</item>
<item name="cornerSizeTopLeft">16dp</item>
<item name="cornerSizeBottomRight">0dp</item>
<item name="cornerSizeBottomLeft">0dp</item>
</style>
<!-- Fonts -->
<style name="SanSerifLightTextView" parent="android:Widget.TextView">
<item name="android:fontFamily">sans-serif-light</item>
</style>
<style name="SansSerifLightButton" parent="android:Widget.Holo.Button">
<item name="android:fontFamily">sans-serif-light</item>
</style>
<style name="SansSerifLightRadioButton" parent="android:Widget.Holo.CompoundButton.RadioButton">
<item name="android:fontFamily">sans-serif-light</item>
</style>
<style name="AppTheme.NoActionBar.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
</resources>

Your issue is here:
<style name="AppTheme" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<item name="imageButtonStyle">#style/Widget.Taskeroo.ImageButton</item>
</style>
<style name="Widget.Taskeroo.ImageButton" parent="Widget.AppCompat.Button.Borderless.Colored">
<item name="tint">#color/colorSecondary</item>
</style>
You are using Widget.AppCompat.Button.* instead of Widget.AppCompat.ImageButton.
The style Widget.AppCompat.Button.Borderless.Colored has a custom dimens.

Change the code like this :
<com.google.android.material.textfield.TextInputLayout
app:endIconDrawable="#drawable/customDrawable">
...
</com.google.android.material.textfield.TextInputLayout>
where custom drawable, is a vector/png image of any shape and size you will define.
If this still doesn't solve your problem, try downgrading to :
implementation 'com.google.android.material:material:1.0.0'
Most probably it will solve your problem.

try this-->
Add dependency:
Gradle:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependency:
implementation 'com.github.HITGIF:TextFieldBoxes:1.4.3'
Use app:endIcon in xml or setEndIcon(Int resourceID) to set the icon of the ImageButton that is shown at the end of the field if you want there to be one.
<studio.carbonylgroup.textfieldboxes.TextFieldBoxes
...
app:endIcon="#drawable/ic_mic_black_24dp"
>
in java:
final TextFieldBoxes textFieldBoxes = findViewById(R.id.text_field_boxes);
textFieldBoxes.getEndIconImageButton().setOnClickListener(new
View.OnClickListener() {
#Override
public void onClick(View view) {
// What you want to do when it's clicked
}
});

Try this solution in your_view.xml
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/til_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:errorEnabled="true"
app:hintEnabled="false"
app:passwordToggleDrawable="#drawable/show_password_selector" <-- add this line
app:endIconMode="password_toggle" <-- add this line
app:passwordToggleEnabled="true"> <-- add this line
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/et_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/hint_password"
android:inputType="textPassword"/>
</com.google.android.material.textfield.TextInputLayout>
You can also use this solution for the start icon
I hope help

Related

android:style not applying in xml layout

I need to apply a custom style to a Spinner.
These are my styles in styles.xml:
<style name="spinnerItemStyle">
<item name="android:textColor">#color/font</item>
<item name="android:textSize">#dimen/small_text</item>
</style>
<style name="spinnerDropDownItemStyle">
<item name="android:padding">10dp</item>
<item name="android:textColor">#color/font</item>
<item name="android:textSize">#dimen/small_text</item>
<item name="android:background">#color/unpressed2</item>
</style>
And I'm doing this in the layout:
android:spinnerItemStyle="#style/spinnerItemStyle"
android:spinnerDropDownItemStyle="#style/spinnerDropDownItemStyle"
<Spinner
android:id="#+id/songSpinner"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="30dp"
android:layout_marginRight="30dp"
android:textSize="#dimen/small_text"
android:entries="#array/songs_array"
android:spinnerItemStyle="#style/spinnerItemStyle"
android:spinnerDropDownItemStyle="#style/spinnerDropDownItemStyle"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHeight_percent="0.18"
app:layout_constraintTop_toBottomOf="#+id/musicSeekBar"
app:layout_constraintWidth_percent="0.5" />
The problem is that Spinner is ignoring the styles applied.
And also I disscovered that it works perfectly if I do this in my custom app theme inside styles.xml:
<style name="AppTheme" parent="Theme.AppCompat.Light">
<item name="android:windowNoTitle">true</item>
<item name="android:windowActionBar">false</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">#null</item>
<item name="colorButtonNormal">#color/unpressed2</item>
<item name="android:buttonStyle">#style/ButtonColor</item>
<item name="android:textColor">#color/font</item>
<!-- spinner styles -->
<item name="android:spinnerItemStyle">
#style/spinnerItemStyle
</item>
<item name="android:spinnerDropDownItemStyle">
#style/spinnerDropDownItemStyle
</item>
</style>
Why works with my second approach and not with the first?
styles.xml File
Add below xml code in your styles.xml File.
<style name="CustomSpinner" parent="AppTheme">
<item name="android:spinnerItemStyle">#style/spinnerItemStyle</item>
<item name="android:spinnerDropDownItemStyle">#style/spinnerDropDownItemStyle</item>
</style>
yourlayout.xml
In Spinner use this styles
For E.g:-
<Spinner
android:id="#+id/songSpinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:theme="#style/CustomSpinner">
</Spinner>

How to not change the color of the label while setting error to particular textinputlayout having edittext inside it?

I am using a Textinputlayout and edittext inside it, problem is when I set the error to the textinputlayout at the time of validations , it changes the color of my hint label also to red. I want to put another color instead of that red color when error comes.Only the underline color and error text should turn to red.
above shown in the pic is the problem, I dont want the email label with red color.
Below is my code.
xml file
<android.support.design.widget.TextInputLayout
android:layout_marginTop="30dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="15dp"
app:errorTextAppearance="#style/error_appearance"
app:hintTextAppearance="#style/TextLabel1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/et1"
android:padding="0dp">
<EditText
android:id="#+id/email"
android:hint="Email"
android:textColorHint="#3F4B5B"
android:maxLines="1"
android:inputType="text"
android:textSize="15sp"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</android.support.design.widget.TextInputLayout>
#java file
#Declarations
private TextInputLayout emailerror;
private EditText Email;
#On create
Email=(EditText) findViewById(R.id.email);
emailerror=(TextInputLayout) findViewById(R.id.et1);
#Inside validation method
emailerror.setError("Enter a valid email");
Style.xml
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
</style>
<style name="AppTheme.NoActionBar" parent="Base.Theme.AppCompat.Light.DarkActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
TextInputLayout text color
<item name="colorControlNormal">#e0e0e0</item>
<item name="colorControlActivated">#52AF44</item>
<item name="android:textColorHint">#3F4B5B</item>
<item name="android:windowFullscreen">true</item>
</style>
<!-- <style name="error" parent="#android:style/TextAppearance">
<item name="android:textColor">#ff0000</item> <!–apply the color you wat here –>
<item name="android:textColorHint">#3E4A58</item>
<!– <item name="android:textColorHint">#3a52a6</item>–>
<!– <item name="android:textSize">12dp</item>–>
</style>-->
<!--<style name="Widget.Design.TextInputLayout" parent="AppTheme">
<item name="hintTextAppearance">#style/TextLabel1</item>
<item name="errorTextAppearance">#style/error_appearance</item>
<item name="counterTextAppearance">#style/TextAppearance.Design.Counter</item>
<item name="counterOverflowTextAppearance">#style/TextAppearance.Design.Counter.Overflow</item>
</style>-->
<style name="error_appearance" parent="#android:style/TextAppearance">
<item name="android:textColor">#color/colorAccent</item>
</style>
<style name="TextLabel1" parent="TextAppearance.Design.Hint">
<item name="android:textColor">#color/colorPrimaryDark</item>
<item name="android:textSize">16sp</item>
</style>
<style name="ToolbarColoredBackArrow" parent="AppTheme">
<item name="android:textColorSecondary">#color/white</item>
</style>
<style name="EditTextHint" parent="Theme.AppCompat">
<!--<item name="colorAccent">#android:color/white</item>-->
<item name="android:textColorHint">#989898</item>
<!-- <item name="colorControlNormal">#color/BackgroundtWhiteColor</item>
<item name="colorControlActivated">#color/your color</item>
<item name="colorControlHighlight">#color/BackgroundtWhiteColor</item>-->
</style>
<style name="Widget.App.Spinner" parent="#style/Widget.AppCompat.Spinner">
<item name="overlapAnchor">true</item>
<item name="android:background">#drawable/spinner_background</item>
</style>
</resources>
You need to override text input layout default style, with your customstyle.
styles.xml
<resources>
<style name="TextLabel">
<item name="android:textColorHint">#color/colorPrimary</item> <!-- Your Hint Color -->
<item name="android:textSize">18sp</item>
<item name="colorAccent">#color/colorPrimary</item>
<item name="colorControlNormal">#color/colorPrimary</item>
<item name="colorControlActivated">#color/colorPrimary</item>
</style>
<style name="error_appearance" parent="#android:style/TextAppearance">
<item name="android:textColor">#color/colorAccent</item>
</style>
</resources>
activity_layout.xml
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_mobile"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:theme="#style/TextLabel"
app:errorTextAppearance="#style/error_appearance">
<EditText
android:id="#+id/edt_mobile"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableLeft="#drawable/ic_phone_iphone_black_24dp"
android:drawablePadding="8dp"
android:drawableTint="#color/colorPrimary"
android:hint="#string/email"
android:inputType="number"
android:textColor="#000" />
</android.support.design.widget.TextInputLayout>
Focused:
Without focus:
Error message:

How to set the style of TextInputEditText in styles.xml

I am using TextInputEditText in my registration screen. I am able to set the style of floating label. I want to set the custom font on hint and text of TextInputEditText using style. Does anyone know whats way of it ?
<android.support.design.widget.TextInputLayout
android:id="#+id/til_registration_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:paddingEnd="#dimen/default_view_padding_right_8dp"
android:paddingStart="#dimen/default_view_padding_left_8dp"
android:textColorHint="#color/colorSecondaryText"
app:hintTextAppearance="#style/AppTheme.InputLayoutStyle"
app:layout_constraintTop_toBottomOf="#id/textview_registration_title">
<android.support.design.widget.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/registration_name"
android:imeOptions="actionNext"
android:singleLine="true"
android:textColor="#color/colorPrimaryText" />
</android.support.design.widget.TextInputLayout>
styles.xml
<style name="AppTheme.InputLayoutStyle" parent="TextAppearance.AppCompat">
<item name="android:textColor">#color/colorPrimary</item>
<item name="fontFamily">#font/lato_light</item>
</style>
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
<item name="drawerArrowStyle">#style/DrawerArrowStyle</item>
<item name="android:textViewStyle">#style/AppTheme.TextView</item>
<item name="buttonStyle">#style/AppTheme.Button</item>
</style>
I want to set style for entire application.
Old question but worth to answer.
Just set the "textInputStyle" to style the TextInputLayouts and "editTextStyle" to style the TextInputEditTexts in your app theme.
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
<item name="drawerArrowStyle">#style/DrawerArrowStyle</item>
<item name="android:textViewStyle">#style/AppTheme.TextView</item>
<item name="buttonStyle">#style/AppTheme.Button</item>
<item name="textInputStyle">
#style/MyCustomTextInputStyle
</item>
<item name="editTextStyle">
#style/MyCustomEditTextStyle
</item>
</style>
<style name="MyCustomTextInputStyle" parent="Widget.Design.TextInputLayout">
<item name="android:textColorHint">#color/colorSecondaryText</item>
<item name="hintTextAppearance">#style/any_style_you_may_want"</item>
</style>
<style name="MyCustomEditTextStyle" parent="Widget.AppCompat.EditText">
<item name="android:textColor">#color/colorPrimary</item>
<item name="fontFamily">#font/lato_light</item>
</style>
This will apply the same style to all TextInputLayout and TextInputEditText in you application.

Handles of EditText are underlined

I encountered a problem recently, which was to change the default underline bar of an edittext from a default blackish color to white.
I used this solution, which seemed to me the best practices by changing the style of the EditText :
EditText
<android.support.v7.widget.AppCompatEditText
android:id="#+id/nom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/Activity_Main_EditText_Nom"
android:imeOptions="actionNext"
android:paddingBottom="10dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="10dp"
android:textColor="#android:color/white"
android:textColorHint="#color/activityBackground"
android:theme="#style/EditTextStyle"
android:visibility="gone"
/>
style.xml
<style name="MyTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowDisablePreview">true</item>
<item name="android:windowBackground">#color/activityBackground</item>
<item name="windowActionBar">false</item>
<item name="actionMenuTextColor">#android:color/white</item>
<item name="android:windowNoTitle">true</item>
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
</style>
<style name="EditTextStyle" parent="Widget.AppCompat.EditText">
<item name="colorControlNormal">#android:color/white</item>
<item name="colorControlActivated">#color/colorAccent</item>
<item name="colorControlHighlight">#color/colorAccent</item>
</style>
It worked ! But it also added to the handles of the EditText an underline bar...
Any ideas ?
Answer
By discussing with #rafsanahmad007, we finally got to a final solution.
style.xml
<resources>
<style name="MyTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowDisablePreview">true</item>
<item name="android:windowBackground">#color/activityBackground</item>
<item name="windowActionBar">false</item>
<item name="actionMenuTextColor">#android:color/white</item>
<item name="android:windowNoTitle">true</item>
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
</style>
<style name="MyTheme.EditText" parent="MyTheme">
<item name="colorControlNormal">#android:color/white</item>
<item name="colorControlActivated">#color/colorAccent</item>
<item name="colorControlHighlight">#color/colorAccent</item>
</style>
</resources>
Apply MyTheme to application, as usual. When you want to tweak an EditText just add to it :
EditText
<EditText
...
android:theme="#style/MyTheme.EditText"
...
/>
Problem is with your style themes.. parent
use below code:
<android.support.v7.widget.AppCompatEditText
android:theme="#style/MyStyle.EditText"/>
Now in your styles.xml
<style name="MyStyle.EditText">
<item name="editTextStyle">#style/MyEditTextStyle</item>
</style>
<style name="MyEditTextStyle" parent="Widget.AppCompat.EditText">
<item name="colorControlNormal">#android:color/white</item>
<item name="colorControlActivated">#color/colorAccent</item>
<item name="colorControlHighlight">#color/colorAccent</item>
</style>
try not to use the theme parent directly
EDIT
add the color property in base theme also
<style name="Theme.App.Base" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorControlNormal">#android:color/white</item>
<item name="colorControlActivated">#color/colorAccent</item>
<item name="colorControlHighlight">#color/colorAccent</item>
</style>
make sure you select the theme in your activity in manifest...
Use this doc.I think this URL will helpfull for your problem.
http://www.materialdoc.com/edit-text/

Style of edittext in API below 21

EditText in API 22 work perfect. Bup for example in API 19 it's seems bad. Will it has relation with gradle?
compile 'com.android.support:design:23.0.1'
In api 19
In api 22 all work perfect
xml
<EditText
android:id="#+id/edt_firstname"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Логин*"
android:textSize="15sp"
android:textColorHighlight="#F14040"
android:layout_marginTop="10dp"
style="#style/Theme.App.Base"
android:backgroundTint="#color/colorPrimary"
android:inputType="phone"
android:maxLength="13"
/>
<EditText
android:id="#+id/lastname"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Пароль"
android:textSize="15sp"
android:textColorHighlight="#F14040"
android:layout_marginTop="10dp"
style="#style/Theme.App.Base"
android:backgroundTint="#color/colorPrimary"
android:inputType="textPassword"
/>
EDIT
it's my style file.
<resources>
<style name="AppTheme" parent="Theme.App.Base">
<item name="toolbarStyle">#style/myToolbarStyle</item>
<item name="toolbarNavigationButtonStyle">#style/myToolbarNavigationButtonStyle</item>
<item name="searchViewStyle">#style/SearchViewMy</item>
</style>
<style name="MyMaterialTheme" parent="MyMaterialTheme.Base">
</style>
<style name="MyMaterialTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorPrimary</item>
<item name="searchViewStyle">#style/SearchViewMy</item>
</style>
<style name="Theme.App.Base" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorControlNormal">#c5c5c5</item>
<item name="colorControlActivated">#color/colorPrimary</item>
<item name="colorControlHighlight">#color/colorPrimary</item>
</style>
<style name="stateTextStyle">
<item name="android:textColor">#000000</item>
<item name="android:padding">5dp</item>
</style>
<style name="myToolbarNavigationButtonStyle" parent="#style/Widget.AppCompat.Toolbar.Button.Navigation">
<item name="android:minWidth">0dp</item>
<item name="android:padding">12dp</item>
<item name="android:scaleType">centerInside</item>
</style>
<style name="myToolbarStyle" parent="#style/Widget.AppCompat.Toolbar">
<item name="android:paddingRight">10dp</item>
</style>
<style name="SearchViewMy" parent="Widget.AppCompat.Light.SearchView">
<item name="submitBackground">#color/white</item>
<item name="queryBackground">#color/white</item>
</style>
</resources>
It is not depended on gradle.Instead of android:layout_height="wrap_content"
use android:layout_height="40dp" a fixed height and check it again

Categories

Resources