アプリで使用した以下のファイル。
レイアウト フォルダー内のmain.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello" />
<EditText android:layout_width="fill_parent"
android:padding="5dip"
android:layout_height="wrap_content"
android:textColor="#00f"
android:textSize="20dip"
android:background="@drawable/bg" />
<EditText android:layout_width="fill_parent"
android:padding="5dip"
android:layout_height="wrap_content"
android:textColor="#00f"
android:textSize="20dip"
android:background="@drawable/bg" />
</LinearLayout>
drawableフォルダー内のmyshape.xml
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#fff"/>
<corners android:radius="2dip" />
<stroke android:width="2dip"
android:color="#ff4500" />
</shape>
drawableフォルダー内のbg.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:state_enabled="true"
android:state_focused="true"
android:drawable="@drawable/myshape"/>
</selector>
Java ファイル
public class EditTextSelector extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}