how to show border of edittext in android studio
To show the border of EditText in Android Studio, you can use the following steps:
- Open the layout file where EditText is placed.
- Add the following code to the EditText element:
android:background="@drawable/edittext_border"
- Create a new file in the drawable folder with the name "edittext_border.xml".
- Add the following code to the "edittext_border.xml" file:
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="5dp" />
<stroke
android:width="1dp"
android:color="#000000" />
<padding
android:left="5dp"
android:right="5dp"
android:top="5dp"
android:bottom="5dp" />
</shape>
- Change the values of the "android:width" and "android:color" attributes to adjust the thickness and color of the border.
- Run the app to see the EditText with a border.
原文地址: https://www.cveoy.top/t/topic/b4UQ 著作权归作者所有。请勿转载和采集!