第一步在drawable-mdpi(根据像素自选)下创建shape.xml文件
内容如下:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<!-- 填充的颜色 -->
<solid android:color="#ffffff" />
<!-- 设置矩形的四个角为弧形 -->
<!-- android:radius弧形半径 -->
<corners android:radius="7dip" />
</shape>
创建文本编辑框
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/shape"
android:text="请输入" />

本文介绍如何在Android应用中创建带有圆角的EditText组件。通过在指定的资源文件夹下建立shape.xml来定义圆角样式,并将该样式应用于EditText中,以此实现圆角效果。
2507

被折叠的 条评论
为什么被折叠?



