所以我試圖掌握在Android中使用自定義控件。但是我的應用程序在嘗試創建活動時崩潰。下面的代碼:在Android中擴展EditText。我究竟做錯了什麼?
package com.myApp;
import android.content.Context;
import android.widget.EditText;
import android.view.View;
import android.view.View.OnClickListener;
public class MyEditText extends EditText implements OnClickListener {
public MyEditText(Context context) {
super(context);
// TODO Auto-generated constructor stub
}
public void FlashBorder()
{
//do some custom action
}
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
EditText txt = (EditText) v;
txt.selectAll();
}
}
這裏的佈局XML:
<com.myApp.MyEditText
android:id="@+id/edtTaskName"
android:layout_height="wrap_content"
android:layout_width="match_parent"/>
檢查這個網址:: http://stackoverflow.com/questions/2026873/android-way-to-appear-bordered-text-on-the-textview –