Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to set margin or padding to error label? #390

Open
hitesh-dhamshaniya opened this issue Dec 19, 2019 · 0 comments
Open

How to set margin or padding to error label? #390

hitesh-dhamshaniya opened this issue Dec 19, 2019 · 0 comments

Comments

@hitesh-dhamshaniya
Copy link

hitesh-dhamshaniya commented Dec 19, 2019

How to set margin or padding to error label?
Can any buddy show me the way to set padding or margin to error label.

<com.google.android.material.card.MaterialCardView
                style="@style/AppEditTextShadow">

                <com.devdigital.core.widget.AppEditText
                    android:id="@+id/edtUserName"
                    style="@style/AppEditText"
                    android:hint="@string/hint_email_address"
                    android:inputType="textEmailAddress" />

            </com.google.android.material.card.MaterialCardView>

Styles

<style name="AppEditTextShadow">
        <item name="android:layout_width">match_parent</item>
        <item name="android:layout_height">wrap_content</item>
        <item name="cardBackgroundColor">@color/colorEditTextBackground</item>
        <item name="cardCornerRadius">@dimen/DP4</item>
        <item name="cardElevation">@dimen/DP8</item>
        <item name="cardPreventCornerOverlap">true</item>
        <item name="cardUseCompatPadding">true</item>
    </style>

 <style name="AppEditText">
        <item name="android:layout_width">match_parent</item>
        <item name="android:layout_height">wrap_content</item>
        <item name="android:padding">@dimen/DP8</item>
        <item name="android:lines">1</item>
        <item name="android:singleLine">true</item>
        <item name="android:background">@drawable/edittext_selector</item>
        <item name="android:textAppearance">@style/TextAppearance.AppCompat.Small</item>
        <item name="met_textColor">@color/colorWhite</item>
        <item name="met_textColorHint">#b2acd8</item>
        <item name="met_floatingLabel">none</item>
        <item name="met_hideUnderline">true</item>
    </style>

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_focused="true" android:drawable="@drawable/edittext_bg"/>
    <item android:drawable="@drawable/edittext_normal_bg"/>
</selector>

edittext_normal_bg.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <stroke android:color="#00000000" android:width="1dp"/>
    <corners android:radius="4dp"/>
</shape>

edittext_bg.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <stroke android:color="@color/colorWhite" android:width="1dp"/>
    <corners android:radius="4dp"/>
</shape>

Check Screenshot here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant