天天看点

android textview边框圆角,android TextView 做成圆角的

方法一:做个圆角的背景图片加上去,比较老套。

方法二:在项目drawable下创建textview.xml内容如下:

encoding="utf-8"?>

xmlns:android="http://schemas.android.com/apk/res/android">

/>

/>

android:right="5dp" android:bottom="5dp" />

在onCreate方法中加入: TextView tv = (TextView)

findViewById(R.id.textView1);

tv.setBackgroundResource(R.drawable.textview);

或者在TextView属性中设置:android:background="@drawable/textview"

如此简单!!!

将EditText做成圆角的只需在xml加入一句话

android:radius="10dip"/>,然后再EditText属性中设置为背景,即可。方法同上.

继续阅读