2

このライブラリを使用してプロジェクトをコンパイルしてみてください。IntelliJ IDEA 12 は、themes.xml の非標準要素でエラーを表示し、コンパイルしません。

アイテム:

<style name="SampleTheme" parent="android:Theme.Holo">
    <item name="numberPickerUpButtonStyle">@style/NPWidget.Holo.ImageButton.NumberPickerUpButton</item>
    <item name="numberPickerDownButtonStyle">@style/NPWidget.Holo.ImageButton.NumberPickerDownButton</item>
    <item name="numberPickerInputTextStyle">@style/NPWidget.Holo.EditText.NumberPickerInputText</item>
    <item name="numberPickerStyle">@style/NPWidget.Holo.NumberPicker</item>
</style>

エラー:

android-apt-compiler: [samples] /Users/max/work/libs/android-numberpicker/samples/res/values/themes.xml:5: error: Error: No resource found that matches the given name: attr 'numberPickerDownButtonStyle'.
android-apt-compiler: [samples] /Users/max/work/libs/android-numberpicker/samples/res/values/themes.xml:6: error: Error: No resource found that matches the given name: attr 'numberPickerInputTextStyle'.
android-apt-compiler: [samples] /Users/max/work/libs/android-numberpicker/samples/res/values/themes.xml:7: error: Error: No resource found that matches the given name: attr 'numberPickerStyle'.
android-apt-compiler: [samples] /Users/max/work/libs/android-numberpicker/samples/res/values/themes.xml:4: error: Error: No resource found that matches the given name: attr 'numberPickerUpButtonStyle'.

この問題は、 および他のライブラリを使用する場合にも発生します。

この問題を解決するには?

4

5 に答える 5

2

プロジェクトに最新の Android プラットフォームを使用していることを確認してください。モジュールの依存関係には、4.0.x 以降のプラットフォーム バージョンが必要です

Android プラットフォーム

于 2012-12-16T02:38:15.903 に答える
1
  • android-numberpicker モジュールに android-calendarview ライブラリも (SimonVT によって) 依存関係として追加する必要があります。
  • これらのライブラリを依存関係としてメイン モジュールに追加します。
  • これらの追加されたプロジェクトをライブラリ プロジェクトとしてマークする
  • このスタイルを、プロジェクトで使用する styles.xml に追加します。(もちろんスタイルチェンジも可能)

        <item name="numberPickerStyle">@style/NPWidget.Holo.NumberPicker</item>
    
于 2013-05-22T14:23:32.667 に答える
1

resourcesノードの子として、同じスタイル ファイルでこれらの属性のタイプを定義する必要があります。

<attr name="numberPickerUpButtonStyle" format="reference" />
于 2012-12-21T11:11:18.050 に答える
0

NumberPicker/DataPicker モジュールは SDK4.2 に設定する必要があります

于 2013-08-02T06:52:38.733 に答える