为什么调用自定义Button控件不能正常显示窗口
写了一个继承Button的类
public class MyButton extends Button {
public MyButton(Context context) {
super(context);
}
public MyButton(Context context, AttributeSet attrs) {
super(context, attrs);
}
public MyButton(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
}
//这里类进行调用
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
MyButton my=(MyButton)findViewById(R.id.buttonOK);//不能正常显示窗口
//Button my=(Button)findViewById(R.id.buttonOK);//可以能正常显示窗口
}
}