使用SimonVT号码选择器并且无法充气xml
所以我使用SimonVT数字选择器来尝试创建一个与姜饼一起使用的数字选择器。 不幸的是,当我尝试将其设置为对话框时,它会在尝试充气xml时崩溃。 老实说,我已经花了一段时间在这上面,并不能为我的爱情弄清楚。 还有其他人吗?
这是它崩溃的地方:
import net.simonvt.numberpicker.NumberPicker; import android.app.AlertDialog; import android.app.Dialog; import android.os.Bundle; import android.support.v4.app.DialogFragment; import android.view.View; public class setSnoozeMethodDialog extends DialogFragment{ @Override public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); View view = getActivity().getLayoutInflater().inflate(R.layout.set_snooze_dialog, null); NumberPicker np = (NumberPicker) view.findViewById(R.id.numberPicker); np.setMaxValue(20); np.setMinValue(0); np.setFocusable(true); np.setFocusableInTouchMode(true); builder.setView(view); return builder.create(); }
这是一个无法充气的xml
这是错误
01-07 23:44:33.308: E/AndroidRuntime(623): FATAL EXCEPTION: main 01-07 23:44:33.308: E/AndroidRuntime(623): android.view.InflateException: Binary XML file line #8: Error inflating class net.simonvt.numberpicker.NumberPicker 01-07 23:44:33.308: E/AndroidRuntime(623): at android.view.LayoutInflater.createView(LayoutInflater.java:518) 01-07 23:44:33.308: E/AndroidRuntime(623): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:570) 01-07 23:44:33.308: E/AndroidRuntime(623): at android.view.LayoutInflater.rInflate(LayoutInflater.java:623) 01-07 23:44:33.308: E/AndroidRuntime(623): at android.view.LayoutInflater.inflate(LayoutInflater.java:408) 01-07 23:44:33.308: E/AndroidRuntime(623): at android.view.LayoutInflater.inflate(LayoutInflater.java:320) 01-07 23:44:33.308: E/AndroidRuntime(623): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
我已将这些放在我的清单中了
这是在我的theme.xml中的value文件夹中
@style/NPWidget.Holo.NumberPicker @style/NPWidget.Holo.Light.NumberPicker
弄清楚了。 我需要补充一下
到我的样式文件,而不是主题文件。
- Android + MySQL使用com.mysql.jdbc.Driver
- 使用lib添加自定义字体android
- 找不到类’android.graphics.drawable.RippleDrawable’,无法执行android的方法:onClick,Android Studio
- 如何在地图上放置JSON lOutput(纬度和经度)
- 是否有针对Java的蓝牙上的任何TCP / IP堆栈实现,更具体的Android?
- `getExternalStorageDirectory()`问题 – Android
- 将日期上限和下限设置为日期选择器对话框
- 小牛上的Eclipse错误:posix_spawn不是此平台上支持的进程启动机制
- android.content.res.Resources $ NotFoundException