私の既存のプロジェクトは、Fragments と FragmentPagerAdapters を使用してスムーズに実行されます。ただし、ActionBarSherlock
ライブラリを追加するとエラーが表示されます。同じ問題を抱えた [別の質問] を見つけましたが、答えがありません。
ライブラリをプロジェクトに追加する前は、エラーなしで次のように表示されます。
ライブラリを追加した後、 を編集しAndroidManifest.xml
て includeを追加するandroid:theme="@android:style/Theme.Sherlock"
と、XML ファイルでもエラーが発生します。に変更するとandroid:theme="@style/Theme.Sherlock"
、XML ファイルのエラーは消えますが、それでも機能せず、エラーは次のようになります。
編集:
以下のCommonsWareの回答で提案されたことを実行しましたが、コードはまだ正しく機能していません. すべてのエラーがなくなり、プロジェクトがビルドされ、デバイスで起動することさえあります。ただし、XML ファイルのグラフィカル レイアウトを入力すると、次のエラーが表示されます。
The following classes could not be found:
- android.support.v4.view.PagerTabStrip (Fix Build Path, Edit XML, Create Class)
XML ファイルは次のようになります。XML ファイルにはエラーが表示されませんが、Graphical Layout
タブに入ると上記のメッセージが表示されることに注意してください。を使用しているとは言いませんでしたViewPager
が、違いがあるとは思いませんでした。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:id="@+id/wavesMonitorMenuBar"
style="@android:style/ButtonBar"
android:layout_alignParentBottom="true"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<Button
android:id="@+id/backButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/menu_back" />
<Button
android:id="@+id/readButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/menu_read" />
</LinearLayout>
<android.support.v4.view.ViewPager
android:id="@+id/statusPager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:layout_above="@id/wavesMonitorMenuBar" >
<android.support.v4.view.PagerTabStrip
android:id="@+id/pager_title_strip"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:background="#9E9E9E"
android:textColor="#fff"
android:paddingTop="4dp"
android:paddingBottom="4dp" />
</android.support.v4.view.ViewPager>
</RelativeLayout>
ここから選択しましFix Build Path
たが、それでも問題を解決できませんでした。と の両方library.jar
を選択しようとしandroid-support-v4.jar
ましたが、役に立ちませんでした。これらのエラーを含む XML ファイルを使用するビューを開こうとすると、プログラムがクラッシュします。
これは、選択したときに表示されるウィンドウですFix Build Path
。