我将标准的EditText小部件分类为
public class MyEditText extends AppCompatEditText {
public MyEditText( Context context )
{
super( context );
}
public MyEditText( Context context, AttributeSet attribute_set )
{
super( context, attribute_set );
}
public MyEditText( Context context, AttributeSet attribute_set, int def_style_attribute )
{
super( context, attribute_set, def_style_attribute );
}
@Override
public boolean onKeyPreIme( int key_code, KeyEvent event )
{
if ( event.getKeyCode() == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_UP )
this.clearFocus();
return super.onKeyPreIme( key_code, event );
}
}
我在我的活动xml布局文件中声明了这个小部件,如此
<MyEditText
android:id="@+id/editText"
android:layout_width="match_parent"
android:layout_height="50dp"
android:hint="[enter command here]"
android:textColorHint="#5042f442"
android:textSize="15dp"
android:textColor="#42f442"
android:background="#50000000"
android:layout_alignParentBottom="true"
android:gravity="center|left"
android:paddingLeft="20dp"
android:cursorVisible="false"
/>
</RelativeLayout>
当我将apk安装到手机并运行应用程序时,我收到此错误
android.view.InflateException:二进制XML文件行#7:错误膨胀类MyEditText
不确定为什么在自定义编辑文字中出现错误。
知道为什么吗?
由于