Im無法使用circlepageindicator加載頁面。這是XMLAndroid CirclePageIndicator無法正常工作
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView android:src="@drawable/bg2" android:layout_width="match_parent"
android:layout_height="match_parent" />
<LinearLayout android:layout_width="220dp"
android:orientation="vertical" android:layout_gravity="center_horizontal"
android:layout_height="32dp" android:layout_marginTop="32dp">
<android.support.v4.view.ViewPager
android:layout_width="match_parent" android:layout_height="match_parent"
android:id="@+id/myfivepanelpager" />
<com.viewpagerindicator.CirclePageIndicator
android:id="@+id/indicator"
android:padding="10dip"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
/>
</LinearLayout>
的java文件
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
MyPagerAdapter adapter=new MyPagerAdapter();
ViewPager myPager=(ViewPager)findViewById(R.id.myfivepanelpager);
myPager.setAdapter(adapter);
myPager.setCurrentItem(2);
CirclePageIndicator titleIndicator = (CirclePageIndicator)findViewById(R.id.indicator);
titleIndicator.setViewPager(myPager);
}
傑克沃頓商學院項目已被添加到庫中。它不會在構建時給出任何錯誤,但不會加載頁面。怎麼了?
它不是該circlepageindicator丟失,網頁本身沒有加載。它再次意外停止。 – JaseemAmeer 2012-04-02 05:48:03
我已經在java buildpath中添加了ur庫項目。但是在xml的設計中,circlepageindicator仍然顯示在灰色框中。 – JaseemAmeer 2012-04-02 05:58:53
您必須將其添加爲「Android」設置下的庫項目,而不是通過Java構建路徑。 – 2012-04-02 19:18:19