ページ表示エラーの表示、タイトルページインジケーターが空です
-
11-12-2019 - |
質問
HI IM ViewPageIndicatorを使用して、魅力のように機能する視点とフラグメントを設定しています。 問題は私がTitlePageIndicatorが機能するように思われていないようです。それはちょうど空であり、Dosntは何も示しています。
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/indicator"
android:layout_alignParentLeft="true"
android:layout_below="@+id/textView2" >
</android.support.v4.view.ViewPager>
<com.viewpagerindicator.TitlePageIndicator
android:id="@+id/indicator"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:padding="10dip"
android:visibility="visible"
app:linePosition="top"
android:theme="@style/CustomUnderlinePageIndicator"/>
.
スタイルに何かがうまくいかないと思われる。ViewPageIndicatorサンプルからスタイルファイルを使用します。
このコードを絶頂したら、次のLogCATエラー:
mPager = (ViewPager)findViewById(R.id.pager);
mPager.setAdapter(mAdapter);
mIndicator = (TabPageIndicator)findViewById(R.id.indicator);
mIndicator.setViewPager(mPager);
.
エラー:java.lang.ClassCastException:Com.ViewPagerIndicator.TitlePageIndicatorはCom.ViewPagerIndicator.TabPageIndicator にキャストできません。
解決
tabpageIndicator またはファイル変更に titepageIndicator の
Mideicator=(TabPageIndicator)FindViewByID(R.ID.Indicator); にとって Mideicator=(TitePageIndicator)FindViewByID(R.ID.Indicator); なぜそれは違うのです
他のヒント
このコードを使う
MPAGER=(ViewPager)FindViewByID(R.ID.View_Pager); MPager.SetAdapter(マダプター);
mIndicator = (TitlePageIndicator) findViewById(R.id.title_indicator);
mIndicator.setViewPager(mPager);
. 所属していません StackOverflow