方法一:做个圆角的背景图片加上去,比较老套。
方法二:在项目drawable下创建textview.xml内容如下:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#ffffffff" />
<corners android:radius="10dp" />
<padding android:left="5dp" android:top="5dp"
android:right="5dp" android:bottom="5dp" />
</shape>
在onCreate方法中加入: TextView tv = (TextView) findViewById(R.id.textView1);
tv.setBackgroundResource(R.drawable.textview);
或者在TextView属性中设置:android:background="@drawable/textview"
如此简单!!!
将EditText做成圆角的只需在xml加入一句话<corners android:radius="10dip"/>,然后再EditText属性中设置为背景,即可。方法同上.