天天看點

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屬性中設定為背景,即可。方法同上.

繼續閱讀