有没有办法使用显示入职进度的代码来创建白点?
is there way to create white dot using code that shows progress of onboarding?
正如您在此看到的 link(http://amyjokim.com/wp-content/uploads/2014/05/Duolingo-Onboarding-3.jpg)
图片底部,有圆点显示入职进度。有没有办法使用显示入职进度的代码来创建白点?创建它们的最佳方法是什么?使用图像?
有没有办法使用显示入职进度的代码创建白点?
试试这个代码。在代码下方的可绘制对象副本中创建一个 xml。如果您想要不同的颜色,请将 ffffff 更改为 your_color
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="oval">
<solid android:color="#ffffff" />
<size
android:width="8dp"
android:height="8dp" />
</shape>
</item>
</layer-list>
那些叫做 ViewPagerIndicator
。
This library provide options for a lot of shapes and sizes in viewpager indicator with sample application.
Include one of the widgets in your view. This should usually be placed
adjacent to the ViewPager it represents.
<com.viewpagerindicator.TitlePageIndicator
android:id="@+id/titles"
android:layout_height="wrap_content"
android:layout_width="fill_parent" />
In your onCreate method (or onCreateView for a fragment), bind the
indicator to the ViewPager.
//Set the pager with an adapter
ViewPager pager = (ViewPager)findViewById(R.id.pager);
pager.setAdapter(new TestAdapter(getSupportFragmentManager()));
//Bind the title indicator to the adapter
TitlePageIndicator titleIndicator = (TitlePageIndicator)findViewById(R.id.titles);
titleIndicator.setViewPager(pager);
(Optional) If you use an OnPageChangeListener with your view pager you
should set it in the indicator rather than on the pager directly.
//continued from above
titleIndicator.setOnPageChangeListener(mPageChangeListener);
正如您在此看到的 link(http://amyjokim.com/wp-content/uploads/2014/05/Duolingo-Onboarding-3.jpg)
图片底部,有圆点显示入职进度。有没有办法使用显示入职进度的代码来创建白点?创建它们的最佳方法是什么?使用图像?
有没有办法使用显示入职进度的代码创建白点?
试试这个代码。在代码下方的可绘制对象副本中创建一个 xml。如果您想要不同的颜色,请将 ffffff 更改为 your_color
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="oval">
<solid android:color="#ffffff" />
<size
android:width="8dp"
android:height="8dp" />
</shape>
</item>
</layer-list>
那些叫做 ViewPagerIndicator
。
This library provide options for a lot of shapes and sizes in viewpager indicator with sample application.
Include one of the widgets in your view. This should usually be placed adjacent to the ViewPager it represents.
<com.viewpagerindicator.TitlePageIndicator android:id="@+id/titles" android:layout_height="wrap_content" android:layout_width="fill_parent" />
In your onCreate method (or onCreateView for a fragment), bind the indicator to the ViewPager.
//Set the pager with an adapter ViewPager pager = (ViewPager)findViewById(R.id.pager); pager.setAdapter(new TestAdapter(getSupportFragmentManager())); //Bind the title indicator to the adapter TitlePageIndicator titleIndicator = (TitlePageIndicator)findViewById(R.id.titles); titleIndicator.setViewPager(pager);
(Optional) If you use an OnPageChangeListener with your view pager you should set it in the indicator rather than on the pager directly.
//continued from above titleIndicator.setOnPageChangeListener(mPageChangeListener);