Java android中绘制边框的问题
我正在尝试实现一个边界来包装我的编辑文本,就像的答案中给出的那样 然而,当我试着给它充气来测试它的工作原理时,我得到了一个错误Java android中绘制边框的问题,java,android,android-layout,Java,Android,Android Layout,我正在尝试实现一个边界来包装我的编辑文本,就像的答案中给出的那样 然而,当我试着给它充气来测试它的工作原理时,我得到了一个错误 android.view.InflateException: Binary XML file line #4: Error inflating class shape 为什么会这样 编辑 我将其粘贴到一个XML文件edittext.XML中 形状应在可绘制文件夹中的xml中定义您不能膨胀形状。请出示您的代码。我已经在问题中添加了一些代码。 <FrameLayou
android.view.InflateException: Binary XML file line #4: Error inflating class shape
为什么会这样
编辑
我将其粘贴到一个XML文件edittext.XML中
形状应在可绘制文件夹中的xml中定义您不能膨胀形状。请出示您的代码。我已经在问题中添加了一些代码。
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<shape
android:shape="rectangle">
<solid android:color="#FAFAD2" />
<stroke android:width="1sp" android:color="#000000"
android:dashWidth="7sp" android:dashGap="5sp" />
</shape>
</FrameLayout>
public class EditBox extends View {
private LayoutInflater layoutInflater;
private FrameLayout viewLayout;
public EditBox(Context context) {
super(context);
try {
layoutInflater = (LayoutInflater) context.getSystemService (Context.LAYOUT_INFLATER_SERVICE);
viewLayout = (FrameLayout) layout_inflater.inflate(R.layout.edittext, null);
} catch(Exception e) {
e.printStackTrace();
}
}
public View getView() {
return viewLayout;
}
}