日々精進

新しく学んだことを書き留めていきます

Viewに枠線をつける

border.xmlのような名前で以下をXMLに定義する。

<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
   <solid android:color="#ffffff" />
   <stroke android:width="1dip" android:color="#4fa5d5"/>
</shape>

あとはこれをbackgroundに設定すればよい。

<TextView android:text="Some text" android:background="@drawable/border"/>

参考: