3
什么的努力来改变杰克沃顿商学院的TitlePagerIndicator 到一个产生,你在谷歌看到Play商店,你之间刷卡 文本渐变效果所需的最低量中的标签之间挥笔标签?我认为关键在于修改onDraw()但这需要我弄清楚他的代码和他的数学。如果有更简单的解决方案,我更喜欢。如何创建文本渐变效果,当用户使用PageIndicator
我也试过TitlePagerIndicator.setFadingEdgeLength(100),但这似乎没有做任何事情。我知道你必须做TitlePagerIndicator.setHorizontalFadingEdgeEnabled(true)但 仍然没有任何消退效果。
下面是杰克的样本的一个基于关代码:
public class SampleTitlesStyledMethods extends BaseSampleActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.simple_titles);
mAdapter = new TestTitleFragmentAdapter(getSupportFragmentManager());
mPager = (ViewPager)findViewById(R.id.pager);
mPager.setAdapter(mAdapter);
TitlePageIndicator indicator = (TitlePageIndicator)findViewById(R.id.indicator);
mIndicator = indicator;
indicator.setViewPager(mPager);
final float density = getResources().getDisplayMetrics().density;
indicator.setBackgroundColor(0x18FF0000);
indicator.setFooterColor(0xFFAA2222);
indicator.setFooterLineHeight(1 * density); //1dp
indicator.setFooterIndicatorHeight(3 * density); //3dp
indicator.setFooterIndicatorStyle(IndicatorStyle.Underline);
indicator.setTextColor(0xAA000000);
indicator.setSelectedColor(0xFF000000);
indicator.setSelectedBold(true);
//my code, doesn't seem to do anything though...
indicator.setHorizontalFadingEdgeEnabled(true);
indicator.setFadingEdgeLength(1000);
}
}
这需要一个答案!你有没有想到巴尼萧? – 2012-12-05 19:53:40