我在Android应用程序中使用 ViewPageIndicator ,特别是 CirclePageIndictor 。要求是 fillColor 将直接移动到指标中的下一个圆圈,没有图片中的这种情况(圆圈移动缓慢并且在分页时保持在中间)
我该怎么做?
答案 0 :(得分:36)
您可以在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 =&#34; http://schemas.android.com/apk/res-auto"在你的布局上。 E.g
<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>
答案 1 :(得分:5)
将snap属性设置为true。
vpi:snap="true"
或
vpi.setSnap(true);
答案 2 :(得分:3)
final CirclePageIndicator circleIndicator = (CirclePageIndicator) findViewById(R.id.indicator);
circleIndicator.setViewPager(_pager);
final float density = getResources().getDisplayMetrics().density;
circleIndicator.setFillColor(0xFFFFFFFF);
circleIndicator.setStrokeColor(0xFFFFFFFF);
circleIndicator.setStrokeWidth(1);
circleIndicator.setRadius(6 * density);
答案 3 :(得分:1)
尝试app:snap =“true”
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 0
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
let g:syntastic_auto_jump = 0