我有这个视图寻呼机,带有一个指示器库,可以为我绘制一个可以着色的圆(非常基本的);我一直在搜索一个图书馆,它允许我放置一个可绘制的而不是圆形(选定和未选择的图片)而不会成功获得结果。有人可以帮忙吗? (因为它不是普通的gradle依赖,因此无法实现Jake Wharton的库)
这是我的寻呼机适配器
private class NewsPagerAdapter extends PagerAdapter {
private Context mContext;
private ArrayList<NewsItem> allNews;
private LayoutInflater mLayoutInflater;
private CustomPagerAdapter imagesPager;
public NewsPagerAdapter(Context context, ArrayList<NewsItem> allNews) {
mContext = context;
mLayoutInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
this.allNews = allNews;
}
@Override
public int getCount() {
return allNews.size();
}
@Override
public boolean isViewFromObject(View view, Object object) {
return view == ((RelativeLayout) object);
}
@Override
public Object instantiateItem(ViewGroup container, final int position) {
View itemView = mLayoutInflater.inflate(R.layout.news_pager_item, container, false);
final WebView detailWebView = (WebView) itemView.findViewById(R.id.detailWebView);
RelativeLayout pagerlayout = (RelativeLayout) itemView.findViewById(R.id.pagerlayout);
final ViewPager pg = (ViewPager) itemView.findViewById(pager);
final PageIndicator mIndicator = (CirclePageIndicator) itemView.findViewById(R.id.indicatorDetailsNews);
imagesPager = new CustomPagerAdapter(NewsDetailActivity.this, allNews.get(position));
pg.setAdapter(imagesPager);
mIndicator.setViewPager(pg);
pg.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
}
@Override
public void onPageSelected(int position) {
mIndicator.setCurrentItem(position);
}
@Override
public void onPageScrollStateChanged(int state) {
}
});
detailWebView.getSettings().setJavaScriptEnabled(true);
detailWebView.loadDataWithBaseURL("file:///android_asset/", "<html><head>\n" +
"<style type=\"text/css\">\n" +
"@font-face {\n" +
" font-family: MyFont;\n" +
" src: url(\"file:///android_asset/GE_Dinar_Two_Medium.otf\")\n" +
"}\n" +
"body {\n" +
" font-family: MyFont;\n" +
" text-align: justify;\n" +
"}\n" +
"</style><body dir=\"rtl\">" + allNews.get(position).getDescription() + "</body></html>", "text/html", "UTF-8", "");
detailWebView.setBackgroundColor(0);
container.addView(itemView);
return itemView;
}
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
container.removeView((RelativeLayout) object);
}
}