You can achieve this by creating a custom shape drawable resource file and setting it as the background of the EditText.
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- Remove the default border -->
<solid android:color="@android:color/transparent" />
<stroke android:width="0dp" />
<!-- Add the underline -->
<stroke android:width="2dp"
android:color="@color/colorAccent" />
</shape>
<EditText
android:id="@+id/myEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/custom_edittext" />
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2021-08-24 11:00:00 +0000
Seen: 9 times
Last updated: Aug 21 '22
How can a ListView be utilized in a ScrollView without a Scrollbar?
How can I detect when someone clicks outside of an Android Compose ModalBottomSheetLayout?
What is the process to activate the screen time off feature in Android using AOSP customization?
What is the proper way to rotate the View Component in React Native for Android?
What is the process of using the Volley library to upload a file on Android?
Is it not possible to set another activity as the main activity in Android Studio?
How can I utilize xml to implement a color filter on an ImageView?