ViewPagerIndicator 不改变颜色
ViewPagerIndicator not changing colours
我已经将 CirclePageIndicator 集成到 viewpager.I 我正在尝试更改填充颜色和页面颜色,但它显示默认颜色 only.Below 是我正在尝试的代码。
布局
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<com.viewpagerindicator.CirclePageIndicator
android:id="@+id/circles"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_below="@+id/header"
android:layout_above="@+id/popup_achievement" />
Class
mViewPager.setAdapter(mAdapter);
circlePageIndicator.setViewPager(mViewPager);
circlePageIndicator.setBackgroundColor(0xFFCCCCCC);
circlePageIndicator.setRadius(15);
circlePageIndicator.setPageColor(R.color.gray);
circlePageIndicator.setFillColor(R.color.das_color);
circlePageIndicator.setStrokeColor(R.color.dffe_color);
circlePageIndicator.setSnap(true);
您必须打开 CirclePageIndicator class。然后你会发现所有如下所示:
//Load defaults from resources
final Resources res = getResources();
final int defaultPageColor = res.getColor(com.viewpagerindicator.R.color.default_circle_indicator_page_color);
final int defaultFillColor = res.getColor(com.viewpagerindicator.R.color.default_circle_indicator_fill_color);
final int defaultOrientation = res.getInteger(com.viewpagerindicator.R.integer.default_circle_indicator_orientation);
final int defaultStrokeColor = res.getColor(com.viewpagerindicator.R.color.default_circle_indicator_stroke_color);
final float defaultStrokeWidth = res.getDimension(com.viewpagerindicator.R.dimen.default_circle_indicator_stroke_width);
final float defaultRadius = res.getDimension(com.viewpagerindicator.R.dimen.default_circle_indicator_radius);
final boolean defaultCentered = res.getBoolean(com.viewpagerindicator.R.bool.default_circle_indicator_centered);
final boolean defaultSnap = res.getBoolean(com.viewpagerindicator.R.bool.default_circle_indicator_snap);
从这里更改您需要的任何更改。谢谢
我已经将 CirclePageIndicator 集成到 viewpager.I 我正在尝试更改填充颜色和页面颜色,但它显示默认颜色 only.Below 是我正在尝试的代码。
布局
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<com.viewpagerindicator.CirclePageIndicator
android:id="@+id/circles"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_below="@+id/header"
android:layout_above="@+id/popup_achievement" />
Class
mViewPager.setAdapter(mAdapter);
circlePageIndicator.setViewPager(mViewPager);
circlePageIndicator.setBackgroundColor(0xFFCCCCCC);
circlePageIndicator.setRadius(15);
circlePageIndicator.setPageColor(R.color.gray);
circlePageIndicator.setFillColor(R.color.das_color);
circlePageIndicator.setStrokeColor(R.color.dffe_color);
circlePageIndicator.setSnap(true);
您必须打开 CirclePageIndicator class。然后你会发现所有如下所示:
//Load defaults from resources
final Resources res = getResources();
final int defaultPageColor = res.getColor(com.viewpagerindicator.R.color.default_circle_indicator_page_color);
final int defaultFillColor = res.getColor(com.viewpagerindicator.R.color.default_circle_indicator_fill_color);
final int defaultOrientation = res.getInteger(com.viewpagerindicator.R.integer.default_circle_indicator_orientation);
final int defaultStrokeColor = res.getColor(com.viewpagerindicator.R.color.default_circle_indicator_stroke_color);
final float defaultStrokeWidth = res.getDimension(com.viewpagerindicator.R.dimen.default_circle_indicator_stroke_width);
final float defaultRadius = res.getDimension(com.viewpagerindicator.R.dimen.default_circle_indicator_radius);
final boolean defaultCentered = res.getBoolean(com.viewpagerindicator.R.bool.default_circle_indicator_centered);
final boolean defaultSnap = res.getBoolean(com.viewpagerindicator.R.bool.default_circle_indicator_snap);
从这里更改您需要的任何更改。谢谢