我在我的 Android 应用程序中使用 ViewPageIndicator,特别是 CirclePageIndictor。要求是 fillColor 会直接移动到指示器中的下一个圆圈,而不会出现图中这种情况(圆圈移动缓慢并在分页时停留在中间)
我该怎么做?
最佳答案
你可以在你的 xml 上试试这个:
<com.viewpagerindicator.CirclePageIndicator
android:id="@+id/indicator"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="10dip"
app:radius="12dp"
app:fillColor="@color/header_bg_color"
app:pageColor="#ffffff"
app:strokeColor="@color/header_bg_color"/>
并且不要忘记在您的布局中添加 xmlns:app="http://schemas.android.com/apk/res-auto"。 例如
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
/>
<com.viewpagerindicator.CirclePageIndicator
android:id="@+id/indicator"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="10dip"
app:radius="12dp"
app:fillColor="@color/header_bg_color"
app:pageColor="#ffffff"
app:strokeColor="@color/header_bg_color"/>
</LinearLayout>
关于android - 圆形页面指示器 - 如何更改填充颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23238298/