Skip to content
This repository was archived by the owner on Mar 28, 2026. It is now read-only.
This repository was archived by the owner on Mar 28, 2026. It is now read-only.

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

@hitesh-dhamshaniya

Description

@hitesh-dhamshaniya

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions