0

このNumberPickerを使用したい私のアプリです:

https://github.com/SimonVT/android-numberpicker

このプロジェクトから .jar ファイルをコピーし、Eclipse でパスを作成し、それを MainActivity クラスにインポートしました。

私のxmlファイルには次のコードがあります:

<net.simonvt.widget.NumberPicker
    android:id="@+id/numberPicker"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" />

しかし、LogCat で次のエラーが発生します。

11-21 15:12:41.486: E/AndroidRuntime(6315): java.lang.RuntimeException: Unable to start activity ComponentInfo{xxxxxxxx.MainActivity}: android.view.InflateException: Binary XML file line #138: Error inflating class net.simonvt.widget.NumberPicker
11-21 15:12:41.486: E/AndroidRuntime(6315): Caused by: android.view.InflateException: Binary XML file line #138: Error inflating class net.simonvt.widget.NumberPicker
11-21 15:12:41.486: E/AndroidRuntime(6315):     at net.simonvt.widget.NumberPicker.<init>(NumberPicker.java:532)

何が起こっている?

ありがとうございました!

4

1 に答える 1

1

lib フォームの Java ビルド パスを追加する必要があります。プロパティを右クリックして、jar を追加するための Java ビルド パスを見つけます。

   <?xml version="1.0" encoding="utf-8"?>
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
   xmlns:custom="http://schemas.android.com/apk/res/net.simonvt.widget.NumberPicker"
   android:layout_width="fill_parent"
   android:layout_height="fill_parent"
   android:orientation="vertical" >
 <net.simonvt.widget.NumberPicker
  android:id="@+id/numberPicker"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content" />
 </LinearLayout

これを試して。

于 2012-11-21T17:19:33.800 に答える