android - 圆形页面指示器 - 如何更改填充颜色

标签 android

我在我的 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/

相关文章:

android - FlatMapCompletable 不会继续 Rx 链,但是带有 "andThen(Observable.just(true)"的可完成平面图可以工作吗?

java - 在从服务器数据更新数据之前,我应该从表 SQLite 中删除数据吗?

安卓移动折线图

java - 如何将图像(应该是精确大小)写入外部存储

java - Crashlytics 错误 - 此应用依赖于 Crashlytics。请注册访问

java - 如何打印 Room 数据库中的内部查询?

java - 我应该如何从 API 获取存储库中的数据

android - SQLITE CREATE VIEW JOIN 的语法问题

java - FirebaseRecyclerView中的FireBaseRecyclerView无法应用于: (arguments)

android - 为什么我无法使用 Android 6.0 配置启动 Android 模拟器?