To show the border of EditText in Android Studio, you can use the following steps:

  1. Open the layout file where EditText is placed.
  2. Add the following code to the EditText element:
android:background="@drawable/edittext_border"
  1. Create a new file in the drawable folder with the name "edittext_border.xml".
  2. 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>
  1. Change the values of the "android:width" and "android:color" attributes to adjust the thickness and color of the border.
  2. Run the app to see the EditText with a border.
how to show border of edittext in android studio

原文地址: https://www.cveoy.top/t/topic/b4UQ 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录