Skip to content

Repository files navigation

EditTextComponent EditTextComponent is a custom Android component designed to enhance the functionality and styling of EditText views in Android applications. This component provides an easy way to create customizable text input fields with advanced features like validation, error handling, and dynamic styling.

Features Customizable text input fields with dynamic hints and error messages. Support for input validation and error display. Easy to integrate into Android applications. Fully customizable styling (e.g., text color, background color, border radius). Lightweight and efficient. Installation To add EditTextComponent to your project, follow these steps:

Clone the repository:

bash Copy code git clone https://github.com/Ojaswakesharwani/EditTextComponent.git Copy the EditTextComponent class into your project or add it as a module in your app.

Include the component in your layout XML files:

xml Copy code <com.example.edittextcomponent.EditTextComponent android:id="@+id/customEditText" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="Enter text" android:textColor="#000000" android:background="#f0f0f0" /> Usage Basic Setup: Simply add the EditTextComponent to your XML layout file, as shown above.

Accessing the EditText in Code: You can access and manipulate the EditTextComponent in your activity or fragment:

kotlin Copy code val customEditText = findViewById(R.id.customEditText) customEditText.setText("Hello, World!") Setting Custom Error Messages: You can set custom error messages when validation fails:

kotlin Copy code customEditText.setError("Invalid input") Adding Custom Validation: You can add your own validation logic and call setError if the validation fails:

kotlin Copy code if (!isValidInput(customEditText.text.toString())) { customEditText.setError("Invalid input") } Customization You can easily customize the appearance and behavior of the EditTextComponent by modifying its attributes. Some of the customizable attributes include:

hint: The hint displayed inside the EditText. textColor: The color of the entered text. backgroundColor: The background color of the EditText. errorColor: The color used for error messages. borderRadius: The corner radius for the EditText background. Example: xml Copy code <com.example.edittextcomponent.EditTextComponent android:id="@+id/customEditText" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="Enter your name" android:textColor="#333333" android:backgroundColor="#ffffff" android:errorColor="#ff0000" android:borderRadius="8dp" /> Contributing Contributions are welcome! If you have suggestions or improvements, feel free to open an issue or submit a pull request. Here are some guidelines:

Fork the repository. Create a new branch (git checkout -b feature/your-feature). Commit your changes (git commit -am 'Add your feature'). Push to the branch (git push origin feature/your-feature). Open a pull request. License This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments Inspired by various Android UI components. Special thanks to the open-source community for continuous learning and support.

About

Dummy component for edit text

Resources

Stars

3 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages