ActionBarSherlockコンポーネントを使用してアプリケーションを開発しています。私の目標は、レベル8API以降のすべてのデバイスをターゲットにすることです。次のxmlを膨らませようとすると、android 2.2.1(レベル8)を実行しているデバイスで例外が発生します。
どのコンポーネントが問題ないのかわかりません。助けてくれませんか?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ImageView
android:id="@+id/albumImg"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:src="@drawable/button" />
<TextView
android:id="@+id/albumStatic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:text="Album :"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textStyle="bold" />
<TextView
android:id="@+id/albumTitle"
style="@android:style/TextAppearance.Holo.Small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/albumStatic"
android:layout_toLeftOf="@+id/albumImg"
android:text="(not found)" />
<TextView
android:id="@+id/albumStatic"
style="@android:style/TextAppearance.Holo.Large"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:text="Album :"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textStyle="bold" />
<TextView
android:id="@+id/artistStatic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/albumTitle"
android:text="Artiste : "
android:textAppearance="?android:attr/textAppearanceLarge"
android:textStyle="bold" />
<TextView
android:id="@+id/artistName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignRight="@+id/albumTitle"
android:layout_below="@+id/artistStatic"
android:text="(not found)" />
<LinearLayout
android:id="@+id/tagsContainer"
android:layout_width="match_parent"
android:layout_height="35dip"
android:layout_alignParentLeft="true"
android:layout_below="@+id/albumImg"
android:gravity="center_vertical"
android:orientation="horizontal" >
<HorizontalScrollView
android:id="@+id/tagsScrollView"
android:layout_width="wrap_content"
android:layout_height="32dip"
android:layout_below="@+id/albumImg"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="center_vertical" >
<LinearLayout
android:id="@+id/tagsLayout"
android:layout_width="wrap_content"
android:layout_height="32dip"
android:orientation="horizontal"
android:gravity="center_vertical"
android:layout_gravity="center_vertical" >
<TextView
android:id="@+id/tags_static"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Tags : "
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="@+id/tags_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="(none)" />
</LinearLayout>
</HorizontalScrollView>
<View
android:id="@+id/vertical_divider"
android:layout_width="1dip"
android:layout_height="match_parent"
android:paddingLeft="16dip"
android:paddingRight="16dip"
android:background="?android:attr/dividerVertical" />
<ImageButton
android:id="@+id/BT_editTags"
android:layout_width="wrap_content"
android:layout_height="32dip"
android:paddingLeft="8dip"
android:paddingRight="8dip"
android:layout_gravity="center_vertical"
android:background="?android:attr/selectableItemBackground"
android:src="@android:drawable/ic_menu_edit" />
</LinearLayout>
<TextView
android:id="@+id/tracks_static"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/tagsContainer"
android:paddingBottom="10dp"
android:paddingTop="10dp"
android:text="Tracks"
android:textAppearance="?android:attr/textAppearanceLarge" />
<ListView
android:id="@+id/tracksListView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/tracks_static" >
<!-- Preview: listitem=@android:layout/simple_list_item_1 -->
</ListView>
<TextView
android:id="@+id/dateStatic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/albumImg"
android:layout_alignParentLeft="true"
android:layout_below="@+id/artistName"
android:text="Date : "
android:textAppearance="?android:attr/textAppearanceLarge"
android:textStyle="bold" />
<TextView
android:id="@+id/date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/dateStatic"
android:layout_alignBottom="@+id/dateStatic"
android:layout_alignRight="@+id/artistName"
android:layout_toRightOf="@+id/dateStatic"
android:text="(not found)" />
</RelativeLayout>
</LinearLayout>
エラーログは、スクロールバーが見つからないことを示しています。しかし、HorizontalScrollViewとlistViewはAPI 8に存在すると確信していますね?
ここにエラーがあります:
06-27 17:11:20.817: E/AndroidRuntime(2064): FATAL EXCEPTION: main
06-27 17:11:20.817: E/AndroidRuntime(2064): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.micky.scanthings/com.micky.scanthings.ScanView}: android.view.InflateException: Binary XML file line #121: Error inflating class android.view.View
06-27 17:11:20.817: E/AndroidRuntime(2064): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2753)
06-27 17:11:20.817: E/AndroidRuntime(2064): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2769)
06-27 17:11:20.817: E/AndroidRuntime(2064): at android.app.ActivityThread.access$2500(ActivityThread.java:129)
06-27 17:11:20.817: E/AndroidRuntime(2064): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2117)
06-27 17:11:20.817: E/AndroidRuntime(2064): at android.os.Handler.dispatchMessage(Handler.java:99)
06-27 17:11:20.817: E/AndroidRuntime(2064): at android.os.Looper.loop(Looper.java:143)
06-27 17:11:20.817: E/AndroidRuntime(2064): at android.app.ActivityThread.main(ActivityThread.java:4717)
06-27 17:11:20.817: E/AndroidRuntime(2064): at java.lang.reflect.Method.invokeNative(Native Method)
06-27 17:11:20.817: E/AndroidRuntime(2064): at java.lang.reflect.Method.invoke(Method.java:521)
06-27 17:11:20.817: E/AndroidRuntime(2064): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
06-27 17:11:20.817: E/AndroidRuntime(2064): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
06-27 17:11:20.817: E/AndroidRuntime(2064): at dalvik.system.NativeStart.main(Native Method)
06-27 17:11:20.817: E/AndroidRuntime(2064): Caused by: android.view.InflateException: Binary XML file line #121: Error inflating class android.view.View
06-27 17:11:20.817: E/AndroidRuntime(2064): at android.view.LayoutInflater.createView(LayoutInflater.java:513)
06-27 17:11:20.817: E/AndroidRuntime(2064): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:544)
06-27 17:11:20.817: E/AndroidRuntime(2064): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:66)
06-27 17:11:20.817: E/AndroidRuntime(2064): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
06-27 17:11:20.817: E/AndroidRuntime(2064): at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
06-27 17:11:20.817: E/AndroidRuntime(2064): at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
06-27 17:11:20.817: E/AndroidRuntime(2064): at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
06-27 17:11:20.817: E/AndroidRuntime(2064): at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
06-27 17:11:20.817: E/AndroidRuntime(2064): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
06-27 17:11:20.817: E/AndroidRuntime(2064): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
06-27 17:11:20.817: E/AndroidRuntime(2064): at com.actionbarsherlock.internal.ActionBarSherlockCompat.setContentView(ActionBarSherlockCompat.java:857)
06-27 17:11:20.817: E/AndroidRuntime(2064): at com.actionbarsherlock.app.SherlockFragmentActivity.setContentView(SherlockFragmentActivity.java:251)
06-27 17:11:20.817: E/AndroidRuntime(2064): at com.micky.scanthings.ScanView.onCreate(ScanView.java:58)
06-27 17:11:20.817: E/AndroidRuntime(2064): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
06-27 17:11:20.817: E/AndroidRuntime(2064): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2717)
06-27 17:11:20.817: E/AndroidRuntime(2064): ... 11 more
06-27 17:11:20.817: E/AndroidRuntime(2064): Caused by: java.lang.reflect.InvocationTargetException
06-27 17:11:20.817: E/AndroidRuntime(2064): at android.view.View.<init>(View.java:1850)
06-27 17:11:20.817: E/AndroidRuntime(2064): at java.lang.reflect.Constructor.constructNative(Native Method)
06-27 17:11:20.817: E/AndroidRuntime(2064): at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
06-27 17:11:20.817: E/AndroidRuntime(2064): at android.view.LayoutInflater.createView(LayoutInflater.java:500)
06-27 17:11:20.817: E/AndroidRuntime(2064): ... 25 more
06-27 17:11:20.817: E/AndroidRuntime(2064): Caused by: android.content.res.Resources$NotFoundException: File res/drawable-hdpi/scrollbar_handle_vertical.9.png from drawable resource ID #0x0
06-27 17:11:20.817: E/AndroidRuntime(2064): at android.content.res.Resources.loadDrawable(Resources.java:1714)
06-27 17:11:20.817: E/AndroidRuntime(2064): at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
06-27 17:11:20.817: E/AndroidRuntime(2064): at android.view.View.<init>(View.java:1901)
06-27 17:11:20.817: E/AndroidRuntime(2064): ... 29 more
06-27 17:11:20.817: E/AndroidRuntime(2064): Caused by: java.io.FileNotFoundException: res/drawable-hdpi/scrollbar_handle_vertical.9.png
06-27 17:11:20.817: E/AndroidRuntime(2064): at android.content.res.AssetManager.openNonAssetNative(Native Method)
06-27 17:11:20.817: E/AndroidRuntime(2064): at android.content.res.AssetManager.openNonAsset(AssetManager.java:418)
06-27 17:11:20.817: E/AndroidRuntime(2064): at android.content.res.Resources.loadDrawable(Resources.java:1706)
06-27 17:11:20.817: E/AndroidRuntime(2064): ... 31 more
編集:これは?android:attr/dividerVertical
andによるものでした?android:attr/dividerVertical
(おそらく、Holoテーマのように)。