我在这段代码中遇到了一个错误的异常
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
appContext=getActivity().getApplicationContext();
myContext=getActivity();
}
private void createAlertBox(final AppointmentRow appointmentRow)
{
final Dialog dialog = new Dialog(myContext, R.style.Dialog);
View layout = LayoutInflater.from(appContext).inflate(R.layout.custom_autocomplete, null);
String[] from={"id","name"};
.....................
.....................
}
以下行发生异常。
View layout = LayoutInflater.from(appContext).inflate(R.layout.custom_autocomplete, null);
例外是 Android.View.InflateException。有什么解决办法吗?
<com.example.netmdapp1.customViews.CustomAutoCompleteTextView
android:id="@+id/customautocomplete"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:completionThreshold="1"
android:ems="10"
android:hint="Patient name"
android:scrollbars="vertical"
android:textColor="@android:color/black"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:background="@drawable/edittext_modified_states"
android:layout_marginTop="5dp">
<requestFocus />
</com.example.netmdapp1.customViews.CustomAutoCompleteTextView>
</LinearLayout>
</LinearLayout>
这是 Xml 部分。有什么想法吗?